gpt4 book ai didi

jquery 和 CSS - Z 索引

转载 作者:技术小花猫 更新时间:2023-10-29 11:20:21 24 4
gpt4 key购买 nike

下面的 jquery 函数 z-index 在 IE7 中不工作,请帮助我

<script>
$(function() {
$('span').hover(function() {

$(this).stop().css({
'float': 'left',
'z-index':'15'
}).animate({
marginTop: '0px',
marginLeft: '0px',
width: '200px',
height: '125px',
padding: '0px'

}, 700, 'swing');


}, function() {

$(this).stop().css({
'border': '0px',
'z-index':'10'
}).fadeIn('slow').animate({
marginTop: '0px',
marginLeft: '0px',
width: '40px',
height: '13px'
}, 700, 'swing');


});
});

</script>

非常感谢帮助。我是 jquery 的新手。

最佳答案

它只在 IE7 中吗?

看起来问题出在第一个函数中的float:left

据我所知,z-index 仅适用于定位元素。 Float 没有定位,因此不能接受 z-index。参见 http://reference.sitepoint.com/css/z-index

如果可能,删除 float 并以另一种方式定位 span

关于jquery 和 CSS - Z 索引,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6189344/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com