SitePoint Sponsor

User Tag List

Results 1 to 3 of 3

Hybrid View

  1. #1
    SitePoint Member phatnugs's Avatar
    Join Date
    Jul 2006
    Location
    Nashvegas
    Posts
    17
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Menu Reveal JS for IE

    hi all i'm using a basic reveal for pcIE. I wanted to know if there was a way to modify this script to have it delay on mouse out? any help would be greatly appreciated.

    Thanks!
    Mike

    Code:
    startList = function() {
    	if (document.all&&document.getElementById) {
    		navRoot = document.getElementById("nav");
    		for (i=0; i<navRoot.childNodes.length; i++) {
    			node = navRoot.childNodes[i];
    			if (node.nodeName=="LI") {
    				node.onmouseover=function() {
    					this.className+=" over";
    				}
    				node.onmouseout=function() {
    					this.className=this.className.replace(" over", "");
    
    				}
    			}
    		}
    	}
    }
    window.onload=startList;
    --
    Mikey P

  2. #2
    SitePoint Evangelist bals28mjk's Avatar
    Join Date
    Aug 2007
    Posts
    405
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hey there,

    setTimeout, and setInterval methods are used for time delays; in your case I'd use setTimeout.

  3. #3
    I'll take mine raw silver trophy MikeFoster's Avatar
    Join Date
    Dec 2002
    Location
    Alabama, USA
    Posts
    2,560
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Here's one way:
    Code:
    function delayMouseout(node, delay)
    {
      setTimeout(
        function () {
          node.className = node.className.replace(" over", "");
        }, delay
      );
    }
    and then in your code you'd have:
    Code:
    				node.onmouseout=function() {
    					delayMouseout(node, 500);
    				};


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
  •