Results 1 to 4 of 4

Thread: Ajax Tabs Run Through Just Once?

  1. #1
    Join Date
    Nov 2007
    Posts
    35
    Thanks
    5
    Thanked 0 Times in 0 Posts

    Default Ajax Tabs Run Through Just Once?

    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/s...ad.php?t=57098)

    2) Script URL (on DD): http://www.dynamicdrive.com/dynamici...tent/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.

  2. #2
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    You can probably use the instance.onajaxpageload function. Say you have:

    Code:
    <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:

    Code:
    <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.
    Last edited by jscheuer1; 08-08-2012 at 05:33 PM. Reason: code correction
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  3. The Following User Says Thank You to jscheuer1 For This Useful Post:

    lrickyutah (08-10-2012)

  4. #3
    Join Date
    Nov 2007
    Posts
    35
    Thanks
    5
    Thanked 0 Times in 0 Posts

    Default

    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.

  5. #4
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    That's what it does.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •