javascript - jQuery toggle button opacity -


i trying toggle 2 buttons's opacity when user hovers on containing div, , when mouse out should go being hidden, @ moment doing try click on 1 of buttons, goes mad , starts toggling opacity on , off repeatedly, here code,

javascript/jquery:

    $('#container').live({       mouseover: function() {           $('.button').fadetoggle();       },       mouseout: function() {           $('.button').fadetoggle();       }     }); 

html:

            <div id="container">                 <div class="button"></div>                 <div></div>                 <div class="button"></div>             </div> 

thanx in advance!

ps: sorry title, forgot change it, showing , hiding buttons fade effect , not toggling opacity.

the mouseover , mouseout events bubble, meaning fire of element's children.

you should handle mouseenter , mouseleave, not bubble.


Comments

Popular posts from this blog

c# - How to set Z index when using WPF DrawingContext? -

razor - Is this a bug in WebMatrix PageData? -

visual c++ - Using relative values in array sorting ( asm ) -