有个显示层,z-index已经很大了,可是下拉菜单还是在它之上,谁能帮忙解答啊?下拉菜单的z-index负值也不
1个回答
展开全部
我以前也经常遇到这个问题,后来我直接用js给每个div加上z-index,就不会出现这个问题了,呵呵……
给你个jquery的代码做这件事的。
//This code will start with a z-index of 10000, and decrement the z-index for each DIV element of the page by 10, giving the first DIV a z-index of 10000, the second, 9990, the third 9980, and so on. Notice that the selector will find all DIV elements with the code "$('div')", using the same syntax as CSS selectors.
$(function() {
var zIndexNumber = 10000;
$('div').each(function() {
$(this).css('zIndex', zIndexNumber);
zIndexNumber -= 10;
});
});
给你个jquery的代码做这件事的。
//This code will start with a z-index of 10000, and decrement the z-index for each DIV element of the page by 10, giving the first DIV a z-index of 10000, the second, 9990, the third 9980, and so on. Notice that the selector will find all DIV elements with the code "$('div')", using the same syntax as CSS selectors.
$(function() {
var zIndexNumber = 10000;
$('div').each(function() {
$(this).css('zIndex', zIndexNumber);
zIndexNumber -= 10;
});
});
追问
白搭,试了,还是那样
追答
帖你代码或者给我你的网址。
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询