我有一个列表(ul)的图像,连续3(看起来像Metro )。我想用jQuery动画这些图像,即在悬停时调整它们的大小。问题是,当图像调整大小(缩放)时,其他元素会移动,以便为缩放的元素腾出空间,从而扰乱整个设计。
我想要做的是使悬停元素与其他图像重叠。我怀疑我可以通过操作它的CSS位置属性来实现这一点,我尝试过,但是我似乎找不到或找出了正确的解决方案。
我使用hoverIntent在悬停时调用操作。
用于放大图像的代码。
$(document).ready(function() {
$(".entry-img").hoverIntent(tall,short);
function tall(){
$(this).animate({"height":300},500);
// code for making the image overlap
}
function short(){
$(this).animate({"height":200},500);
// remove the "overlap property"
}
});发布于 2013-08-08 16:14:38
尝试将函数更改为:
function tall(){
$(this).parent().css('position', 'absolute').css('z-index','10').animate({"height":300},500);
}
function short(){
$(this).parent().css('position','relative').css('z-index','1').animate({"height":200},500);
}https://stackoverflow.com/questions/18130690
复制相似问题