Search code examples
jquerycycle

jQuery Cycle animation doesn't work


I would like to use jQuery Cycle Plugin to animate logos from sponsors in my sidebar on this site

I have tried different html markups and js code variations to call the cycle-function, but I can't get it working.

Is the .js file loaded in the wrong place? Anything wrong with the markup?

Any help is much appreciated, thank you!


Solution

  • I think there was a conflict between some scripts there are used on that page. I found a solution though by recreating the problem: First, you used $(".sponsoren") which is wrong, because sponsoren is an id. So it should have been $("#sponsoren").

    Second, you should place the script location and the script itself on the bottom of the page. After doing so, it still didn't work for me, so I got rid of the $(document).ready(function(){}); part, since it wasn't necessary anymore. I ended up with the following code:

    <script src="http://malsup.github.com/jquery.cycle.all.js" type="text/javascript"></script>
    <script type="text/javascript">
        jQuery('#sponsoren').cycle({
            fx: 'scrollDown'
        });
    </script>
    

    Remember, I placed this on the bottom of the page, and this seemed to work. This might not be the best solution, but it works this way.