I am using this fadeTo div code from here , which freezes in one of the two divs, depending on the hang.
What I would like to do is add a third option - and a third div called #maindiv, as follows: "If you hover over #maindiv, do not fade either #sidebar or #primarycontainter, but if it hangs #sidebar or #primarycontainter , then fade out any of them (depending on the hover), but don't disappear #maindiv. "
How can I do this (with a different expression?) While preserving an existing else statement that prevents IE6 from using any code? Thanks....
Edit 2/3/10: Is there any other way to handle this due to three divs? Is a callback required or some way to update the function, since the code below leads to an incompatible fadeTo action?
$(document).ready(function(){ if ($.browser.version = jQuery.browser.msie && parseInt(jQuery.browser.version) == 6) { } else { $("#sidebar").fadeTo('fast', 0.5); $("#sidebar").hover(function(){ $(this).stop().fadeTo('fast', 1); $("#primarycontainer").stop().fadeTo('fast', 0.5); },function(){ $(this).stop().fadeTo('fast', 0.5); $("#primarycontainer").stop().fadeTo('fast', 1); } ); } });
Edit 2/09/10:
Ed Woodcock answers below, works with small changes (of my choice) in my comments on his answer.
This is CSS:
<body> <div id="outerdiv" div style="position: relative;"> <div id="maindiv" div style="position:relative;">Lorem ipsum dolor sit amet.</div> <div id="content"> <div id="primary" div style="float: left; margin-right: -20.0em; width: 100%;"> <div id="primarycontainer" div style="margin-right: 16.0em;"> <p>Lorem ipsum dolor sit amet.<p> </div></div> <div id="sidebar" div style="float: right; width: 15.0em;">Lorem ipsum dolor sit amet.</div> </div></div> </html> </body>
source share