Results 1 to 5 of 5

Thread: 1 Second Pause on Tab Content Script

  1. #1
    Join Date
    Sep 2008
    Posts
    12
    Thanks
    9
    Thanked 0 Times in 0 Posts

    Default 1 Second Pause on Tab Content Script

    1) Script Title: Tab Content Script (v 2.2)

    2) Script URL (on DD): http://www.dynamicdrive.com/dynamici...tabcontent.htm

    3) Describe problem: http://www.ennis.com

    Right now, when a user scrolls over the tabs, the content changes. At first, this seemed like a great idea, but I've heard several users complain and its been annoying me also.

    What I would like to add is a 1 second pause to each tab. If a user scrolls over another tab, it wont automatically jump to that tab, but pause for 1 second, then go to the selected tab (or go to that tab by click). Any help as to where to make this change in the script. Thanks!
    Last edited by ddadmin; 10-28-2008 at 09:29 PM.

  2. #2
    Join Date
    Aug 2004
    Posts
    10,143
    Thanks
    3
    Thanked 1,008 Times in 993 Posts
    Blog Entries
    16

    Default

    Try replacing the following code in your .js file:

    Code:
    				this.tabs[i].onmouseover=function(){
    					tabinstance.expandtab(this)
    					tabinstance.cancelautorun() //stop auto cycling of tabs (if running)
    					return false
    				}
    with the below instead:

    Code:
    				this.tabs[i].onmouseover=function(){
    					tabinstance.cancelautorun() //stop auto cycling of tabs (if running)
    					clearTimeout(tabinstance.delayshow)
    					var curtab=this
    					tabinstance.delayshow=setTimeout(function(){
    						tabinstance.expandtab(curtab)
    						return false
    					}, 1000)
    				}
    				this.tabs[i].onmouseout=function(){
    					clearTimeout(tabinstance.delayshow)
    				}
    The 1000 denotes 1 second (or 1000 milliseconds), so you can adjust as desired.
    DD Admin

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

    kris@ennis (10-28-2008)

  4. #3
    Join Date
    Sep 2008
    Posts
    12
    Thanks
    9
    Thanked 0 Times in 0 Posts

    Default

    That worked great ddadmin! Thanks for doing that.

    One last question... is it possible to allow the user to not only scroll over and wait, but also have the option to go to that tab by click? As of right now, you have to wait half a second for the tab to change.

    www.ennis.com

    Thanks!

  5. #4
    Join Date
    Aug 2004
    Posts
    10,143
    Thanks
    3
    Thanked 1,008 Times in 993 Posts
    Blog Entries
    16

    Default

    Sure. Directly beneath the new code I posted above, try adding the following block:

    Code:
    				this.tabs[i].onclick=function(){
    					tabinstance.expandtab(this)
    					tabinstance.cancelautorun() //stop auto cycling of tabs (if running)
    					clearTimeout(tabinstance.delayshow)
    					return false
    
    				}
    DD Admin

  6. The Following User Says Thank You to ddadmin For This Useful Post:

    kris@ennis (10-31-2008)

  7. #5
    Join Date
    Sep 2008
    Posts
    12
    Thanks
    9
    Thanked 0 Times in 0 Posts

    Default

    Man, you're amazing. Thank you! Works great!

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
  •