I am looking to do something very simple. I have many DIV boxes arranged in a grid. When I hover one of them, I want it to expand slowly, anchored from the middle, and then shrink back down. However, I have not been able to do so without the other DIV boxes being pushed aside. I want the DIV being hovered on to expand slowly, overlapping the other DIV boxes, without moving them. I have accomplished some of this with JQuery. Here is what I have:
CSS:
div{width: 100px; height: 100px; float: left;}
div#sq1{background-color: magenta;}
div#sq2{background-color: yellow;}
div#sq3{background-color: cyan;}
JQuery:
<script type='text/javascript' src='animated.js'></script>
<script type="text/javascript">
$(document).ready(function() {
$("div").hover(function(){
if (!$(this).hasClass('animated')) {
$(this).dequeue().stop().animate({ width: "100px", height: "100px" });
}
}, function() {
$(this).addClass('animated').animate({ width: "200px", height: "200px" }, "normal", "linear", function() {
$(this).removeClass('animated').dequeue();
});
});
</script>
HTML:
<div id="dequeue" class="blocks">
<div id="sq1"></div>
<div id="sq2"></div>
<div id="sq3"></div>
</div>
Here's how I want it to look: Before : http://i39.tinypic.com/dh9x87.png After: http://i44.tinypic.com/70cd35.png
Thanks!