gpt4 book ai didi

html - CSS 相对和绝对,忽略 z-index

转载 作者:可可西里 更新时间:2023-11-01 14:56:10 29 4
gpt4 key购买 nike

我有一个 li 的网格,它们都以固定的宽度/高度向左浮动。问题是当我将鼠标悬停在中心的最新产品上时,显示的 div 未定位在顶部并位于下一个 li 的

编辑/突破:如果我删除相对 li 上的 z-index 这适用于除 IE7 之外的所有浏览器

最佳答案

尝试更改悬停的 LI 的 z-index 以使其大于它的 sibling ,就像在您的 productOver 函数中一样:

function productOver(){
var product_html = $(this).find(".product_html");
// Generate HTML only on first hover.
if(product_html.data("generated") != true){
var tis = $(this);
product_html.find(".name").html(tis.find("h2").html());
product_html.find(".price").html(tis.find(".price").html());
product_html.data("generated", true);
}
$(this).css('z-index','10'); //add this
product_html.stop().fadeTo('fast', 1).show();
}

当然,在 productOut 上将其设置回默认值

function productOut(){ 
$(this).css('z-index', '8'); //add this
$(this).find(".product_html").stop().fadeTo('slow', 0, function() {
$(this).hide();
});
}

关于html - CSS 相对和绝对,忽略 z-index,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8134804/

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