I am looking for a jquery script to implement the ease in and out effect with hide/show div that is implemented on this site.
Here is my script on mouseover():
$("#box0").mouseover(function () {
$("#lSection2").fadeIn(100);
$("#boxContent0").fadeIn(100);
});
$('#boxContent0').mouseout(function() {
$("#boxContent0").fadeOut(100);
$("#lSection2").fadeOut(100);
});
CSS:
.AdBox {
width: 300px;
height: 180px;
border: 6px solid #fff;
-webkit-border-radius: 5px;
-moz-border-radius: 5px;
-o-border-radius: 5px;
border-radius: 5px;
float: left;
margin-right: 10px;
margin-left: 10px;
}
.AdBoxl {
width: 300px;
height: 180px;
border: 6px solid #666;
float: right;
}
.boxContent div {
width: 180px;
padding: 10px;
font-family: Arial, Helvetica, sans-serif;
font-weight: bold;
font-size: 16px;
height: 120px;
border: 4px solid #fff;
float: left;
margin-right: 10px;
margin-left: 20px;
-webkit-border-radius: 3px;
-moz-border-radius: 3px;
-o-border-radius: 3px;
border-radius: 3px;
background-color: #80634A;
}
#lSection2 {
height: 120px;
width: 100%;
position: relative;
top: 10px;
padding-left: auto;
padding-right: auto;
}
.boxContent {
width: 970px;
background-image: url(../images/gridtile.png);
height: 150px;
padding-top: 15px;
}
HTML:
mouse over or click to view details
Win Big
– Ipad
– Holiday
– 1 Year Spa Treatments
doesn’t seem to work please help.
You do not need a special plugin to do jQuery easing. You would simple include your chosen easing function into your jQuery like this. (I picked ‘easeOutCubic’ just as an example applied to all animations but each animation could also have its own.)
See this answer for more details…
jQuery.easing – easeOutCubic – emphasizing on the ease
You can visually review some easing functions here…
http://jqueryui.com/demos/effect/easing.html
These are the corresponding functions. Just select and use the functions relevant to your project…
Sidenotes:
Your code is using
mouseoverandmouseoutwhich could lead to erratic behavior due to how these events are fired.mouseoverwill fire multiple times while your mouse is over the item.mouseenterandmouseleaveare much more stable. You could even use.hover()which automatically combines.mouseenter()and.mouseleave()into one method.And your animation duration of
100is only one-tenth of one second. This is far too quick to be able to see any easing effect.