PDA

View Full Version : Ajax Tabs Run Through Just Once?



lrickyutah
08-08-2012, 08:18 AM
1) Script Title: Ajax Tabs Content Script (v 2.2) (with the fade-in edit posted here in the forums, http://www.dynamicdrive.com/forums/showthread.php?t=57098)

2) Script URL (on DD): http://www.dynamicdrive.com/dynamicindex17/ajaxtabscontent/index.htm

3) Describe problem: I have 4 "slides" I'd like slide #1 to display 4 seconds, #2 and 3 for 3 seconds and the last slide to stop. Is that even possible without completely rewriting the script? Any help would be greatly appreciated.

jscheuer1
08-08-2012, 02:16 PM
You can probably use the instance.onajaxpageload function. Say you have:


<script type="text/javascript">

var countries=new ddajaxtabs("countrytabs", "countrydivcontainer")
countries.setselectedClassTarget("link") //"link" or "linkparent"
countries.setpersist(false)
countries.init(4000)

</script>

That will take care of the first one being displayed for 4 seconds. Then you can add to that:


<script type="text/javascript">

var countries=new ddajaxtabs("countrytabs", "countrydivcontainer")
countries.setselectedClassTarget("link") //"link" or "linkparent"
countries.setpersist(false)
countries.init(4000)
countries.count = 0;

countries.onajaxpageload=function(pageurl){
if(++countries.count === 1){
countries.cancelautorun();
countries.autoruntimer = setInterval(function(){countries.autorun()}, 3000);
} else if (countries.count === 4){
countries.cancelautorun();
}
}
</script>

Notice the use of countries throughout the code. If you're using a different variable name, replace each instance of countries with it.

The browser cache may need to be cleared and/or the page refreshed to see changes.

If you want more help, please include a link to the page on your site that contains the problematic code so we can check it out.

lrickyutah
08-10-2012, 07:03 AM
That worked great! Thank you, so much!

Any idea how to make slides display at different times? Slide 1 for 4 seconds, 2 and 3 for 3 seconds, stopping on 4.

jscheuer1
08-10-2012, 08:26 AM
That's what it does.