-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?

Anik Islam Abhi
  • 25,137
  • 8
  • 58
  • 80
  • Check browser console for error messages. You might have a conflict with other js frameworks, such as `mootools`, for example. – Cheery Nov 22 '14 at 03: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 '14 at 03:23
  • Have you checked the code i posted? http://i.imgur.com/lYSD0R9.png – Jaiden Watling Nov 22 '14 at 03: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 ```` – Elise Chant Nov 22 '14 at 03:57
  • I'm not completely crazy. i already checked to see if it resolved to the correct directory by simply accessing https://www.datastreak.org/js/jquery.js Which works. No change when hotlinking to google. – Jaiden Watling Nov 22 '14 at 03:59
  • Production code loads inewsticker **then** jquery, while development code loads jquery then inewsticker, something like that? – nrodic Nov 22 '14 at 04:13

2 Answers2

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

Elise Chant
  • 5,048
  • 3
  • 29
  • 36
  • 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. – Jaiden Watling Nov 22 '14 at 04:49
0

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

Jadiction
  • 16
  • 3