jQuery-始终在顶部
是否可以使用jQuery使元素始终位于顶部?我可以在CSS中使用jQuery-始终在顶部,jquery,css,Jquery,Css,是否可以使用jQuery使元素始终位于顶部?我可以在CSS中使用z-index,但在InternetExplorer7中,它只能使用position:relative和位置必须为绝对。也许我可以用jQuery做些什么 现在,我的jQuery文件如下所示: $(document).ready(function(){ $('#mainmenu li.item').hover(function(){ $('.sub',this).show(); }, func
z-index
,但在InternetExplorer7中,它只能使用position:relative代码>和位置
必须为绝对
。也许我可以用jQuery做些什么
现在,我的jQuery文件如下所示:
$(document).ready(function(){
$('#mainmenu li.item').hover(function(){
$('.sub',this).show();
},
function(){
$('.sub',this).hide();
});
});
CSS:
有许多jQuery脚本可以修复IE7中的z索引问题
z-index的作用应该与绝对和相对完全相同。。。即使在ie7中
#mainmenu li .sub{
text-transform:lowercase;
display: none;
position: absolute;
float: left;
top: 31px;
left: 0px;
background:url("images/sub-menu-bg.png") repeat-x;
z-index:6;
padding-left:15px;
padding-bottom:15px;
padding-top:15px;
width: 280px;
color: #3e4f77;
z-index: 4;
}