[英]Why the jquery news ticker is not working on my website?
我添加到我的主页embed html并添加了这段代码/脚本:
<ul class="newsticker">
<li>Etiam imperdiet volutpat libero eu tristique.</li>
<li>Curabitur porttitor ante eget hendrerit adipiscing.</li>
<li>Praesent ornare nisl lorem, ut condimentum lectus gravida ut.</li>
<li>Nunc ultrices tortor eu massa placerat posuere.</li>
</ul>
<script src="http://code.jquery.com/jquery-1.10.1.min.js"></script>
<script src="js/newsTicker.js"></script>
<script>
$('.newsticker').newsTicker();
</script>
从所有者站点获取代码示例:
https://github.com/risq/jquery-advanced-news-ticker
由于我的网站编辑是在weebly.com我已经上传了js文件。 我试图改变这一行:
<script src="js/newsTicker.js"></script>
至:
<script src="/files/theme/jquery.newsTicker.js"></script>
试过第一个主题:
到目前为止没有任何工作。 我在我的网站上有这个文件我上传了:
jquery.newsTicker.js
jquery.newsTicker.min.js
jquery.ticker.js
脚本应该使文本向上滚动。 但它不起作用。 我没有看到文本静态不动。
编辑
这就是我在控制台中得到的:
Failed to load resource: the server responded with a status of 404 (Not Found) http://www.dragndropbuilder.com/files/theme/jquery.newsTicker
Uncaught TypeError: Object [object Object] has no method 'newsTicker' apps/customHtml.php?ucfid=838201711125452969&w=1395277796370&w=139527783313…2562870&w=1395292592083&w=1395292871153&w=1395292967301&w=1395292990574:56
6
Consider using 'dppx' units instead of 'dpi', as in CSS 'dpi' means dots-per-CSS-inch, not dots-per-physical-inch, so does not correspond to the actual 'dpi' of a screen. In media query expression: only screen and (-webkit-min-device-pixel-ratio: 2), not all, not all, not all, only screen and (min-resolution: 192dpi), only screen and (min-resolution: 2dppx)
Failed to load resource: the server responded with a status of 404 (Not Found) http://www.dragndropbuilder.com/files/theme/jquery.newsTicker.js
Uncaught TypeError: Object [object Object] has no method 'newsTicker' customHtml.php?ucfid=838201711125452969&w=1395277796370&w=1395277833139&w=1395277850426&w=139527788…:56
好像插件的路径不正确,请再次检查,或者您可以使用直接链接:
<script src="http://risq.github.io/jquery-advanced-news-ticker/assets/js/jquery.newsTicker.js"></script>
代替:
<script src="/files/theme/jquery.newsTicker.js"></script>
以及将jQuery代码包装在里面:
jQuery(function($) {
$('.newsticker').newsTicker();
});
在您使用其他JavaScript库时防止冲突。
去萤火虫,
在“网络”选项卡中,检查是否包含插件脚本js / css。
确保它没有显示红色。
红色表示没有获得正确的路径,因此出现404错误。
顺便说一下,这个插件不适用于最近的Jquery版本,最适合1.6。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.