I am currently working on a code that expands and centers a div when hovered upon using the following script:
$(document).ready(function(){
//animation on hover
$('#sliding_grid li').hover(function() {
$(this).addClass('highlight');
}, function() {
//$(this).removeClass('highlight');
});
$(".highlight").live("hover", function(){
$(this).animate({"width": "454px", "height":"282px", "top: ":"94px", "left":"152px", "margin-top: ":"-94px", "margin-left":"-152px"}, 500);
});
$(".highlight").live("mouseout", function(){
$(this).animate({"width": "148px", "height":"90px", "top: ":"0px", "left":"0px", "margin-top: ":"0", "margin-left":"0"}, 500, function(){
$(this).removeClass('highlight');
});
});
});
The issues I am facing are as follows:
1) I'm struggling with resetting the "top" and "left" css coordinates to their original values on mouseOut. You can view a demo of this here:
2) The z-index is not affecting the hovered grid elements as expected. More details can be found here: http://jsfiddle.net/kTFvj/1/