简体   繁体   中英

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

I added to my main page embed html and added this code/script:

<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. 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(function($) {
    $('.newsticker').newsTicker();
});

to prevent conflict in case you're using other javascript libraries.

Go to firebug,

In the "Net" tab, check whether your plugin script js/css is getting included.

Make sure that it is not showing red.

Red means its not getting the correct path and hence a 404 error.

检查是否包含js文件

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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