javascript - jQuery hover Issue with div -


i want show/hide data on mouse hover on div tag.

my html:

 <div id='container'>                         <div id="box" style="visibility: hidden">                             <a href="#" class="bt btleft">highlight it</a>                             <a href="#" class="bt btright">reset</a>                         </div>                     </div> 

my jquery:

 <script>     $(document).ready( function() {         $("#container").hover(             function () {                 $(this).children("div").show(100);             },             function () {                 $(this).children("div").hide(100);             });​     });  </script> 

but, hover doesn't anything!! please suggest way around.

.show() , .hide() toggle display property, not visibility. if want animate visibility, animate opacity css property:

$(document).ready(function() {    $("#container").hover(      function() {        $(this).children('div').animate({'opacity':'1'},100);      },      function() {        $(this).children('div').animate({'opacity':'0'},100);      });  });
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>    <div id='container'>    <div id="box" style="opacity: 0">      <a href="#" class="bt btleft">highlight it</a>      <a href="#" class="bt btright">reset</a>    </div>  </div>


Comments

Popular posts from this blog

css - SVG using textPath a symbol not rendering in Firefox -

Java 8 + Maven Javadoc plugin: Error fetching URL -

order - Notification for user in user account opencart -