Alvaro Gomez
Alvaro Gomez

Reputation: 360

Conflict between plugin and existing jquery code

Separately, my jquery code works, and the downloaded plugin also. But when i try to fit them together (trying separate scripts in the header, same script in header/ body, external scripts separate/together..), just 1 or none of them work.

The plugin is called TinySlideshow (https://github.com/jhorstmann/TinySlideshow), the code inserted in the html script is the following:

<script>
 $('slideshow').style.display='none';
 $('wrapper').style.display='block';
 var slideshow=new TINY.slideshow("slideshow");
 window.onload=function(){
        slideshow.auto=true;
        slideshow.speed=5;
        slideshow.link="linkhover";
        slideshow.info="information";
        slideshow.thumbs="slider";
        slideshow.left="slideleft";
        slideshow.right="slideright";
        slideshow.scrollSpeed=4;
        slideshow.spacing=5;
        slideshow.active="#fff";
        slideshow.init("slideshow","image","imgprev","imgnext","imglink");
     }
    </script>

My question is, where do i have to include my $(document).ready(function(){ in order to avoid conflicts with the plugin?

Upvotes: 0

Views: 104

Answers (1)

Barmar
Barmar

Reputation: 782785

Change:

$('slideshow').style.display='none';
$('wrapper').style.display='block';

to:

$T('slideshow').style.display='none';
$T('wrapper').style.display='block';

$T is a function in the TinySlideShow plugin that's just an abbreviation for document.getElementById.

You should either put all this code at the end or after the <body>, or put it all in the $(document).ready() handler.

Upvotes: 2

Related Questions