jQuery(document).ready(function(){
jQuery(".main").hover(function(){
jQuery(this).find(".main-a").show();
jQuery(".main-a").each(function(){
var heightnum = jQuery(".main-a").outerHeight();
var boxheight = jQuery(".child-a").outerHeight();
var allheight = (heightnum - boxheight) /2;
$(this).find(".child-a").css({ "position": "absolute", "top": allheight + "px", "display": "block" });
});
jQuery(this).find("img").stop().animate({"width":"320px","height":"220px","margin":"-10px","overflow":"hidden"},"slow");
},function(){
jQuery(this).find(".child-a").hide();
jQuery(this).find("img").stop().animate({"width":"300px","height":"200px","margin":"0px","overflow":"hidden"},"slow");
});
});
但是没有效果,这个应该如何改呢?
与图中对应
.main = 黑色框 (这个是三个框的DIV)
.main-a = 浅黑色框 (鼠标移动上去后显示里面图片分别向四周放大10px)
.child-a = 灰色框(主要想让这个DIV垂直居中,高度没有设置)
纯 CSS 就可以实现 http://blog.csdn.net/wolinxuebin/article/details/7615098
我发明的方法
<div style="height:100px;background:red">
<span style="vertical-align:middle;line-height:100px">‌</span><!--这个很重要-->
<div style="background:yellow;height:10px;width:10px;vertical-align:middle;display:inline-block"></div>
</div>
很简单的问题让你们回答得这么复杂了