javascript - Mouse Out Orange Div "CurrentHeight" is not applying -
latest demo intermadiate issue
on hover iam calculating current height of div , adding 50px through jquery. on mouseout current height not applying
for example:
currentheight = 20px (this height dynamic)
addheight = 50px
so div 70px on mousehover
when mouseout currentheight should same i.e., 20px (this height dynamic)
js code :
txt__mouse__hover : function(){ $(".itemmastxt").hover(function () { currentheight = $(this).height(); addheight = 50; $(this).animate({ height:(currentheight + addheight) }, 200); }, function () { alert(" --" + currentheight) $(this).animate({ height:(currentheight) }, 200); });
check demo
var counter = 0; $(".itemmastxt").hover(function () { if(inntertext !== $(this)[0].innertext){ counter = 0; } if(counter == 0){ innerheight = $(this).innerheight(); innerheightadd = $(this).innerheight() + addheight; inntertext = $(this)[0].innertext; } counter++; $(this).stop().animate({ height:(innerheight + addheight) }, 200); }, function () { $(this).stop().animate({ height:(innerheightadd - addheight) }, 200); });
Comments
Post a Comment