简体   繁体   English

Typed.js动画眨眼光标不起作用

[英]Typed.js Animated blinker cursor not working

So I'm trying to use the blinker cursor on typed.js an awesome js.plugin which can be found here: https://github.com/mattboldt/typed.js 所以我试图在typed.js上使用眨眼光标,这是一个很棒的js.plugin,可以在这里找到: https : //github.com/mattboldt/typed.js

I'm trying to get the blinker cursor inline with the text as it types but as you can see at the minute from the jsfiddle: https://jsfiddle.net/harrydry/p4ev1nj2/ it is just blinking on the side. 我正在尝试使闪烁器光标与键入的文本保持一致,但是正如您在jsfiddle上看到的那样: https ://jsfiddle.net/harrydry/p4ev1nj2/,它只是在侧面闪烁。

The reason for this is that I have applied some an id to typed so that the text is centered and the font is changed etc. 原因是我将一些id应用于键入,以便使文本居中并更改字体等。

Unfortunately, this seems to have ruined the blinker effect. 不幸的是,这似乎破坏了眨眼效果。

Is anyone aware of how to get both the blinker working with CSS styling applied as shown on the js fiddle. 有谁知道如何使两个闪烁灯都与js小提琴中所示的CSS样式一起应用。

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

This is the code on typed.js page to get the typed-cursor blinking correctly 这是typed.js页面上的代码,可让类型光标正确闪烁

Thanks a lot for any help. 非常感谢您的帮助。 Of course, I will upvote the correct answer etc. Enjoy the day harry :) 当然,我会支持正确的答案等。

That's what worked for me: 那对我有用:

 .typed-cursor {
        opacity: 1;
        animation: blink .7s infinite;
    }

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

This code works for me 该代码对我有用

.typed-cursor{
        opacity: 1;
        font-weight: 100;
        -webkit-animation: blink 0.7s infinite;
        -moz-animation: blink 0.7s infinite;
        -ms-animation: blink 0.7s infinite;
        -o-animation: blink 0.7s infinite;
        animation: blink 0.7s infinite;
    }

I hope this will help. 我希望这将有所帮助。 Works fine for me. 对我来说很好。

.typed-cursor {
    -webkit-animation: blinker 1s linear infinite;
            animation: blinker 1s linear infinite;
}

@-webkit-keyframes blinker {
    50% {
        opacity: 0;
        -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=0)";
    }
}

@keyframes blinker {
    50% {
        opacity: 0;
        -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=0)";
    }
}

I was also trying to fix the issue, But I found something similar answer. 我也在尝试解决此问题,但是我找到了类似的答案。 Hope this will work. 希望这会起作用。

.your-class:after{
    visibility: visible;
    content: '';
    background-color: #fff;
    display: inline-block;
    position: relative;
    width: 2px;
    height: 1em;
    top: 5px;
    margin-left: 3px; }

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM