1
<!DOCTYPE html>
<html>

<style >
.element{

font-size: 100px

}

.typed-cursor{
    font-size: 100px
    opacity: 1;
    -webkit-animation: blink 0.7s infinite;
    -moz-animation: blink 0.7s infinite;
    animation: blink 0.7s infinite;
}
@keyframes blink{
    10% { opacity:1; }
    50% { opacity:0; }
    100% { opacity:1; }
}
@-webkit-keyframes blink{
    10% { opacity:1; }
    50% { opacity:0; }
    100% { opacity:1; }
}
@-moz-keyframes blink{
    10% { opacity:1; }
    50% { opacity:0; }
    100% { opacity:1; }
}

</style>


<head>
    <script src="jquery-2.1.4.js"></script>
    <script type="text/javascript" src="typed.js"></script>
</head>

<body>
<span class = "element">
<script>
  $(function(){
      $(".element").typed({
        strings: ["agdsgdggd","okay"],
        typeSpeed: 100,
        loop: true,
        cursorChar: "|",
      });
  });
</script>


</span>

</body>

</html>

所以我让我的元素跨度有一个默认的文本大小,它修改了文本,但光标没有改变。我试图在 css 中设置光标大小,但似乎没有用。也许有人知道我想念的把戏。谢谢你。

4

1 回答 1

9

我在回答我自己的问题。这是使文本和光标对于键入的 javascript 库具有相同大小的解决方案,

.typed-cursor{
    font-size: 100px
    opacity: 1;
    -webkit-animation: blink 0.7s infinite;
    -moz-animation: blink 0.7s infinite;
    animation: blink 0.7s infinite;
}

忘记了字体大小的分号

.typed-cursor{
    font-size: 100px;
    opacity: 1;
    -webkit-animation: blink 0.7s infinite;
    -moz-animation: blink 0.7s infinite;
    animation: blink 0.7s infinite;
}

现在工作。

于 2015-06-18T22:54:31.973 回答