Sunday, December 23, 2012

Show/Hide div on mouse hover in Jquery

Mouse Out Mouse Over
First add the below HTML code to your page which contains two div tags. One is the main tag and the other one is the overlay tag.

<div id="divTest">
<div id="overlay1" class="overlay">
I'm Hover 1
Mouse Over me.

Then we need to hide the overlay tag on page load. Add below code between page header tags

<style type="text/css">

Now add below Jquery script.

<script src="jquery-1.8.3.js" type="text/javascript"></script>

<script type="text/javascript">
     $(document).ready(function () {
                  $('#divTest').hover(function () {
                      $('#overlay1').animate({ height: '30px', opacity: 'show' }, 300);
                  function () {
                      $('#overlay1').animate({ height: '0', opacity: 'hide' }, 300);



Write comments
Recommended Posts × +