繁体   English   中英

为什么ejs和jquery(jquery-advanced-news-ticker)在此代码中发生冲突?

[英]why does ejs and jquery(jquery-advanced-news-ticker) collide in this code?

我有一个节点应用程序,正在使用ejs作为我的视图驱动程序,并且我正在尝试使用这个很棒的插件。

该代码本身可以很好地运行,但是当我使用ejs加载动态代码时,它将停止。 (如果我尝试使用静态html则可以完美地工作)。

我的EJS:

<% if(jobs !== undefined){ %>
<div class="container">
    <div class="well well-sm newswell">
        <ul class="newsticker"><strong>
            <% jobs.forEach(function(item){ %>
                <li><%= item.message %></li>
            <% }); %>
        </strong></ul>
    </div>
</div>
<% } %>

和脚本:

jQuery(document).ready(function() {
      setTimeout(function() {
         $('.newsticker').newsTicker({
            max_rows: 1,
            speed: 600,
            direction: 'down',
            duration: 4000,
            pauseOnHover: 1
            });
      }, 2000);
   });

他们为什么会碰撞?

我最终使用了插件的方法停止然后再启动,它成功了。

暂无
暂无

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

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