Link to home
Start Free TrialLog in
Avatar of jej07
jej07

asked on

Help needed with setTimeout function

My website uses the responsive image slider from slippry.com. On the same page, I want to add a setTimeout function that will delay a modal from appearing. Separately, both work fine, however there seems to be a conflict which I can't identify when both are used.

$(document).ready(function() {
// This is what's used to call the slider:
    jQuery('#slider').slippry({
        adaptiveHeight: false,
        controls: true,
        pause: 8000,
        autoDelay: 5000
        });
       

// This is where I setTimeout:
        setTimeout(function() {
          $('#signUpModal').modal('show');
        }, 2000);

});

Any help figuring out what's going on would be greatly appreciated.
Avatar of COBOLdinosaur
COBOLdinosaur
Flag of Canada image

There will always be a conflict when there is more than one function using a timeout.  You could try a setInterval and see if that helps, otherwise you need to either kill one of the timeout functions; consolidate them; or convert one to use CSS transitions; or change the design to something that works.

Cd&
ASKER CERTIFIED SOLUTION
Avatar of Rob
Rob
Flag of Australia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of jej07
jej07

ASKER

Thank you Rob, for setting up a test page. I didn't even know the jsbin.com site existed - it's pretty nice.

Utilizing what you put together I was able to track down the source. Turns out there was another script on the page that I had missed entirely, which was causing the problem.