0

我正在处理以下代码。此函数创建“类型化”效果。此功能在 chrome 中运行良好,但在 safari 中运行良好。Safari 的 jquery 有问题吗?


var Typed = (function() {

    var typed = '.typed',
        $typed = $(typed);


    function init($this) {
        var el = '#' + $this.attr('id'),
            strings = $this.data('type-this'),
            strings = strings.split(',');

        var options = {
            strings: strings,
            typeSpeed: 100,
            backSpeed: 70,
            loop: true
        };

        var animation = new Typed(el, options);

        inView(el).on('enter', function() {
            animation.start();
        }).on('exit', function() {
            animation.stop();
        });
    }

    if ($typed.length) {
        $typed.each(function() {
            init($(this));
        });
    }

})();
<span class="typed" id="type-example-1" data-type-this="text1., text2., text3., text4."></span>

4

0 回答 0