• Hello
  • I am mahdi khaksar from iran
  • I am designer and programmer at progpars.com
  • w" />
  • Hello
  • I am mahdi khaksar from iran
  • I am designer and programmer at progpars.com
  • w" />
  • Hello
  • I am mahdi khaksar from iran
  • I am designer and programmer at progpars.com
  • w"/>

    Can someone please explain why this jQuery isn't working?

    219 Views Asked by At

    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?

    2

    There are 2 best solutions below

    0
    Jadiction On BEST ANSWER

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

    1
    Elise Chant On

    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