Results 1 to 2 of 2

Thread: Can you make this auto-slide back?

  1. #1
    Join Date
    Apr 2012
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Can you make this auto-slide back?

    1) Script Title: Slide-In Links

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

    3) Describe problem: Does anybody know if the is a simple code change to make this menu slide back automatically after a short time, instead of having to click the tab again.

  2. #2
    Join Date
    Dec 2008
    Location
    Portsmouth, UK
    Posts
    1,891
    Thanks
    2
    Thanked 441 Times in 435 Posts

    Default

    Code:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    
    <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
    
    <head>
      <title></title>
    <style>
    
    #divMenu {font-family:arial,helvetica; font-size:12pt; font-weight:bold}
    #divMenu a{text-decoration:none;}
    #divMenu a:hover{color:red;}
    </style>
    <script language="JavaScript1.2">
    /****************************************
    Submitted with modifications by Jack Routledge (http://fastway.to/compute) to DynamicDrive.com
    Copyright (C) 1999 Thomas Brattli @ www.dhtmlcentral.com
    This script is made by and copyrighted to Thomas Brattli
    This may be used freely as long as this msg is intact!
    This script has been featured on http://www.dynamicdrive.com
    ****************************************
    Browsercheck:*/
    ie=document.all?1:0
    n=document.layers?1:0
    ns6=document.getElementById&&!document.all?1:0
    
    //These are the variables you have to set:
    
    //How much of the layer do you wan't to be visible when it's in the out state?
    lshow=60
    
    //How many pixels should it move every step?
    var move=10;
    
    //At what speed (in milliseconds, lower value is more speed)
    menuSpeed=40
    
    //Do you want it to move with the page if the user scroll the page?
    var moveOnScroll=true
    
    /***************************************
    You should't have to change anything below this.
    ****************************************/
    //Defining variables
    
    var ltop;
    var tim=0;
    
    //Object constructor
    function makeMenu(obj,nest){
        nest=(!nest) ? '':'document.'+nest+'.'
        if (n) this.css=eval(nest+'document.'+obj)
        else if (ns6) this.css=document.getElementById(obj).style
        else if (ie) this.css=eval(obj+'.style')
    	this.state=1
    	this.go=0
            if (n) this.width=this.css.document.width
            else if (ns6) this.width=document.getElementById(obj).offsetWidth
            else if (ie) this.width=eval(obj+'.offsetWidth')
    	this.left=b_getleft
        this.obj = obj + "Object"; 	eval(this.obj + "=this")
    }
    //Get's the top position.
    function b_getleft(){
            if (n||ns6){ gleft=parseInt(this.css.left)}
            else if (ie){ gleft=eval(this.css.pixelLeft)}
    	return gleft;
    }
    //***********************************
    //Deciding what way to move the menu (this is called onmouseover, onmouseout or onclick)
    //************************************
    function moveMenu(ms){
        clearTimeout(mOut.to);
    	if(!oMenu.state){
    		clearTimeout(tim)
    		mIn()
      }else{
    		clearTimeout(tim)
    		mOut(ms)
    }
    }
    //Menu in
    function mIn(){
    	if(oMenu.left()>-oMenu.width+lshow){
    		oMenu.go=1
    		oMenu.css.left=oMenu.left()-move
    		tim=setTimeout("mIn()",menuSpeed)
    	}else{
    		oMenu.go=0
    		oMenu.state=1
    	}
    }
    //Menu out
    function mOut(ms){
    	if(oMenu.left()<0){
    		oMenu.go=1
    		oMenu.css.left=oMenu.left()+move
    		tim=setTimeout(function(){ mOut(ms); },menuSpeed)
    	}else{
    		oMenu.go=0
    		oMenu.state=0
            if (typeof(ms)=='number'){
             mOut.to=setTimeout(function(){ moveMenu(ms); },ms);
            }
    	}
    }
    //*********************************
    //Checking if the page is scrolled, if it is move the menu after
    //**********************************
    function checkScrolled(){
    	if(!oMenu.go) oMenu.css.top=eval(scrolled)+parseInt(ltop)
    	if(n||ns6) setTimeout('checkScrolled()',30)
    }
    //*********************************
    //Inits the page, makes the menu object, moves it to the right place,
    //show it
    //**********************************
    function menuInit(){
    	oMenu=new makeMenu('divMenu')
            if (n||ns6) scrolled="window.pageYOffset"
            else if (ie) scrolled="document.body.scrollTop"
    	oMenu.css.left=-oMenu.width+lshow
            if (n||ns6) ltop=oMenu.css.top
            else if (ie) ltop=oMenu.css.pixelTop
    	oMenu.css.visibility='visible'
    	if(moveOnScroll) ie?window.onscroll=checkScrolled:checkScrolled();
    }
    
    
    //Initing menu on pageload
    window.onload=menuInit;
    </script></head>
    
    <body>
    <div id="divMenu" style="position:absolute; top:250; left:30; visibility:hidden; background-color:F0F0F0">
    <nobr>
    	<a href="http://www.dynamicdrive.com">Dynamic Drive</a> -
    	<a href="http://www.codingforums.com">Coding Forums</a> -
    	<a href="http://active-x.com/">Active-X.com</a> -
    	<a href="javascript://" onclick="moveMenu(2000)" style="background-color:yellow;text-decoration:none">MENU</a>
    </nobr>
    </div>
    
    </body>
    
    </html>
    Vic
    God Loves You and will never love you less.
    http://www.vicsjavascripts.org/Home.htm
    If my post has been useful please donate to http://www.operationsmile.org.uk/

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
  •