Solved

Help needed with setTimeout function

Posted on 2015-01-09
3
179 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
ID: 40541186
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 43

Accepted Solution

by:
Rob earned 500 total points
ID: 40541259
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
ID: 40541578
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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Bootstrap question 4 26
Customising IE behaviour on certain pages 2 55
Saving Web Page as PDF 9 33
Why is my $_POST not going to results page 10 32
Developer portfolios can be a bit of an enigma—how do you present yourself to employers without burying them in lines of code?  A modern portfolio is more than just work samples, it’s also a statement of how you work.
When crafting your “Why Us” page, there are a plethora of pitfalls to avoid. Follow these five tips, and you’ll be well on your way to creating an effective page.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
Any person in technology especially those working for big companies should at least know about the basics of web accessibility. Believe it or not there are even laws in place that require businesses to provide such means for the disabled and aging p…

679 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