Solved

Help needed with setTimeout function

Posted on 2015-01-09
3
156 Views
Last Modified: 2015-01-09
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.
0
Comment
Question by:jej07
3 Comments
 
LVL 53

Expert Comment

by:COBOLdinosaur
Comment Utility
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&
0
 
LVL 42

Accepted Solution

by:
Rob Jurd, EE MVE earned 500 total points
Comment Utility
Not sure what you're doing wrong as this works ok for me: http://jsbin.com/xuwoce/1/edit?html,js,output

I assume you're using bootstrap for the modal?
0
 
LVL 1

Author Closing Comment

by:jej07
Comment Utility
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.
0

Featured Post

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

Why do we like using grid based layouts in website design? Let's look at the live examples of websites and compare them to grid based WordPress themes.
Any business that wants to seriously grow needs to keep the needs and desires of an international audience of their websites in mind. Making a website friendly to international users isn’t prohibitively expensive and can provide an incredible return…
This video teaches users how to migrate an existing Wordpress website to a new domain.
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

772 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now