All you need: LIVE DEMO
$(document).on('mouseenter mouseleave', '.frame', function( e ) {
var $el=$(this),
h = $el.height(),
w = $el.width(),
$bott = $el.find(".contentBottom"),
$top = $el.find(".contentTop"),
mEnt = e.type == "mouseenter"; // boolean
// this
$el.stop().animate({borderRadius: mEnt? 0 : 3 });
// top
$top.css({bottom: h, width: w, zIndex:1})
.html('top top top top')
.stop().slideToggle(function(){
$(this).css({zIndex:0});
});
// bottom
$bott.css({top: h, width: w, zIndex:1})
.html('bottom bottom bottom bottom<br>bottom bottom bottom bottom<br>bottom bottom bottom bottom<br>bottom bottom bottom bottom<br>')
.stop().slideToggle(function(){
$(this).css({zIndex:0});
});
});
Note: .stop()
method, and mEnt
boolean variable and it's use with Conditional Operator statement ? ifTrue : ifFalse