简体   繁体   English

为什么jquery新闻自动收报机无法在我的网站上运行?

[英]Why the jquery news ticker is not working on my website?

I added to my main page embed html and added this code/script: 我添加到我的主页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>

Taken the code example from the owner site: 从所有者站点获取代码示例:

https://github.com/risq/jquery-advanced-news-ticker

Since my website edit is at weebly.com i uploaded already the js files. 由于我的网站编辑是在weebly.com我已经上传了js文件。 I tried to change this line: 我试图改变这一行:

<script src="js/newsTicker.js"></script>

To: 至:

<script src="/files/theme/jquery.newsTicker.js"></script>

Tried first theme: 试过第一个主题:

Nothing was working so far. 到目前为止没有任何工作。 I have this files on my site i have uploaded: 我在我的网站上有这个文件我上传了:

jquery.newsTicker.js
jquery.newsTicker.min.js
jquery.ticker.js

The script should make the text scrolling up. 脚本应该使文本向上滚动。 But it's not working. 但它不起作用。 It does nothing i see the text static not moving. 我没有看到文本静态不动。

EDIT 编辑

This is what i'm getting in the console: 这就是我在控制台中得到的:

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

Seem like the path to your plugin is incorrect, please check again or you can use direct link: 好像插件的路径不正确,请再次检查,或者您可以使用直接链接:

<script src="http://risq.github.io/jquery-advanced-news-ticker/assets/js/jquery.newsTicker.js"></script>

instead of: 代替:

<script src="/files/theme/jquery.newsTicker.js"></script>

as well as wrapping your jQuery code inside: 以及将jQuery代码包装在里面:

jQuery(function($) {
    $('.newsticker').newsTicker();
});

to prevent conflict in case you're using other javascript libraries. 在您使用其他JavaScript库时防止冲突。

Go to firebug, 去萤火虫,

In the "Net" tab, check whether your plugin script js/css is getting included. 在“网络”选项卡中,检查是否包含插件脚本js / css。

Make sure that it is not showing red. 确保它没有显示红色。

Red means its not getting the correct path and hence a 404 error. 红色表示没有获得正确的路径,因此出现404错误。

检查是否包含js文件

顺便说一下,这个插件不适用于最近的Jquery版本,最适合1.6。

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

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