集成css / js打字机效果,jsfiddle

时间:2017-08-01 21:37:20

标签: javascript css effect

我试图整合This打字机效果。

我已尝试在此设置https://jsfiddle.net/74cq52az/

但没有运气,任何人都可以看看,并给我一个提示是什么错误的?

我按照说明中的步骤进行操作。

HTML

<script src="www.cognition-webdesign.dk/wp-content/themes/cognition/js/Typist-master/dist/typist.js"></script>
<strong id="typist-element" data-typist="sut,min,dut">great</strong>

CSS

@keyframes blink {
0% { opacity: 1.0; }
50% { opacity: 0.0; }
100% { opacity: 1.0; }
}

@-webkit-keyframes blink {
0% { opacity: 1.0; }
50% { opacity: 0.0; }
100% { opacity: 1.0; }
}

#typist-element {
&:after {
content: " ";
display: inline-block;
height: 47px;
position: relative;
top: 10px;
margin-left: 3px;
margin-right: 7px;
width: 4px;
background: #06a44d;
animation: blink 1s step-start 0s infinite;
-webkit-animation: blink 1s step-start 0s infinite;
}
}

.selectedText {

}

的Javascript

(function () {
var typist;
typist = document.querySelector('#typist-element');
new Typist(typist, {
    letterInterval: 60,
    textInterval: 3000.
});
}.call(this));

1 个答案:

答案 0 :(得分:0)

您的脚本src缺少https协议:

将脚本标记更改为:

<script src="https://www.cognition-webdesign.dk/wp-content/themes/cognition/js/Typist-master/dist/typist.js"></script>

如果查看控制台,您会看到以下错误:

Mixed Content: The page at 'https://jsfiddle.net/74cq52az' was loaded over HTTPS, but requested an insecure script 'http://www.cognition-webdesign.dk/wp-content/themes/cognition/js/Typist-master/dist/typist.js'. This request has been blocked; the content must be served over HTTPS.