Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    Regular Coder
    Join Date
    Aug 2010
    Posts
    405
    Thanks
    17
    Thanked 2 Times in 2 Posts

    want to prevent fade if moused over.

    I have a div that appears under a link (similar to a subnav) when that link is moused over.

    I want the div to fade, if they've moused away from the link UNLESS they've moused over the div.

    But my attempt failed:


    Code:
        	$('.tnav-views').live("mouseleave", function(event){
        		var timer = setTimeout(function(){
            	    $("#view_levels_subnav").hide(); // regular hide
            	}, 1000); // 1 second
        	});
        
        	$("#view_levels_subnav").mouseover(function(){
        	    clearTimeout(timer);
        	 });

  • #2
    Senior Coder
    Join Date
    Jan 2011
    Location
    Missouri
    Posts
    3,760
    Thanks
    23
    Thanked 546 Times in 545 Posts
    @turpentyne, when you have TWO div, please uses their names to tell the difference between them. It's sometimes hard to understand what your trying to do when you say div this, div that. I changed the names of the div, hope this is what you want:

    Code:
    <!DOCTYPE html>
    <html>
    <head>
    <script type='text/javascript' src='javascript/jquery.js'></script>
    <script type="text/javascript">
    $(document).ready(function(){
    	$("#top").mouseenter(function(){
    		$("#bottom").show();
    	})
    	.mouseleave(function(){
    		$("#bottom").hide();
    	});
    	
    	$("#bottom").mouseenter(function(){
    		$("#bottom").show();
    	})
    	.mouseleave(function(){
    		$("#bottom").hide();
    	});
    });
    </script>
    <style type="text/css">
    #bottom{display: none;margin-left: 100px;}
    </style>
    </head>
    <body>
    	<div id="top" class="both" style="border: red solid 1px;">Stuff so we know tnav-views is here</div>
    	<div id="bottom" class="both" style="border: blue solid 1px;">Stuff so we know sub menu is working</div>
    </body>
    </html>
    Evolution - The non-random survival of random variants.


  •  

    Posting Permissions

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