-2

So, I've got this:

<ul class="fade">
   <li>Hello</li>
   <li>I am mahdi khaksar from iran</li>
   <li>I am designer and programmer at progpars.com </li>
   <li>www.ijquery.ir</li>
</ul>
<script src="https://www.datastreak.org/js/jquery.js"></script>
<script src="https://www.datastreak.org/js/inewsticker.js"></script>
<script>
   $(document).ready(function() {
       $('.fade').inewsticker({
        speed       : 3000,
        effect      : 'fade',
        dir         : 'ltr',
        font_size   : 13,
        color       : '#000',
        font_family : 'arial',
        delay_after : 1000      
    });

   });  
</script>

http://jsfiddle.net/mmuxdoo8/

In a standalone HTML file, it works perfectly. But when I add it to our main site, I get this:

image

What am I missing here?

6
  • Check browser console for error messages. You might have a conflict with other js frameworks, such as mootools, for example.
    – Cheery
    Nov 22, 2014 at 3:21
  • 1
    Have you even checked your console? inewsticker.js gives jquery is not defined error. You're probably referencing jquery after ticker.
    – artm
    Nov 22, 2014 at 3:23
  • Have you checked the code i posted? i.imgur.com/lYSD0R9.png Nov 22, 2014 at 3:48
  • You probably have incorrect paths to jquery etc because of the web server root. Check the path is resolved in the Network tab of Google Dev Tools, you may need to change you path to '../jquery.js' or try using a CDN version of jquery to test that you are not completely crazy <script src="//ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> Nov 22, 2014 at 3:57
  • I'm not completely crazy. i already checked to see if it resolved to the correct directory by simply accessing datastreak.org/js/jquery.js Which works. No change when hotlinking to google. Nov 22, 2014 at 3:59

2 Answers 2

0

It was indeed a JS conflict. There was no problem with the code, the problem is now fixed.

0

Your example has no syntax issues. Proven http://jsfiddle.net/z48c1s7b/

$(document).ready(function() {
  alert('You are not crazy!');
}); 

This means jQuery is working.

It must mean that you aren't initialising your component correctly.

Although it looks like it works to me:

enter image description here

1
  • 1
    I don't really see how this is an answer.. but okay. Thanks. you've re-stated what i said originally. The code works, but not when it's on our page. Nov 22, 2014 at 4:49

Not the answer you're looking for? Browse other questions tagged or ask your own question.