【问题标题】:Internet Explorer Z-IndexInternet Explorer Z 索引
【发布时间】:2011-11-09 14:23:00
【问题描述】:

我为此编写了一个小 JavaScript:http://www.tx-customers.com/ep-immobilien/?page_id=183。

现在在 Internet Explorer 中,我遇到了图层问题,因此悬停功能无法正常工作。与特定图像相关的图像顶部有列表项,更改要查看的图像的类别。这可行,但如果您单击一个图像或滑块激活(3 秒后),则 li-items 位于显示的图像后面。它适用于 FF、Opera、Safari 和 Chrome。 我已经搜索了 z-index 解决方法尝试设置位置和 z-index,但它没有任何改变。

HTML 结构是:

<div id="team">
    <div class="images">
        <img id="1-team-member-picture" class="team-member" src="img-src" rel="185">
        <li class="splitter" rel="1"></li>
        <img id="2-team-member-picture" class="team-member" src="img-src" rel="185">
        <li class="splitter" rel="2"></li>
        <div id="results">
            <p class="res"></p>
        </div>
        <p class="clear"></p>
    </div>
</div>

CSS 代码:

#team .images {
    float: left;
    background: url(images/gesamt_962px.png) no-repeat;
    position: relative;
    height: 382px;
    width: 769px;
    z-index: 5;
    padding-left: 64px;
}

#team .images img {
    height: 382px;
    position: relative;
    z-index: 4;
}

#team .images .team-member {
    position: absolute;
    display: none;
    left: 32px;
}

#team .images .current, #team .images .clicked {
    display: inline;
}

#team .images li {
    width: 30px;
    height: 382px;
    float: left;
    position: relative;
    z-index: 20;
    list-style-type: none;
}

IE 的 CSS 代码(试一试):

#mainwrap {
    font: 14px/20px Times New Roman, Times, sans-serif;
}

#team {
    width: 800px;
    margin: 0 auto;
    position: relative;
    z-index: 20;
}

#team .images {
    margin: 0 auto;
    background: url(images/gesamt_962px.png) no-repeat;
    position: relative;
    height: 382px;
    width: 769px;
    padding-left: 64px;
    z-index: 10;
}

#team .images .team-member {
    position: absolute;
    display: none;
    left: 32px;
    z-index: 0 !important;
}

#team .images .current, #team .images .clicked {
    position: absolue;
    display: inline;
    z-index: 0 !important;
}

#team .images li {
    width: 30px;
    height: 382px;
    float: left;
    list-style-type: none;
    position: relative;
    z-index: 1 !important;
}

这是脚本: http://www.tx-customers.com/ep-immobilien/wp-content/themes/epi/js/teamSlider.js

这是我第一次尝试 JS,所以请不要因为一些愚蠢的编码而责怪我! :P

JS 中使用 Hover 的部分。

jQuery($splitter).mouseover( function () {
    if(!$clicked) stopAnimate();
    slideRemoveClass("current");
    $('#' + $(this).attr('rel') + '-team-member-picture').addClass("current");
});

jQuery($splitter).mouseleave( function () {
    if(!$clicked) animate();
    slideRemoveClass("current");
    $('#' + $(this).attr('rel') + '-team-member-picture').removeClass("current");
});

function animate() {
    clearTimeout(interval);
    interval = setTimeout( slide, $delay );
}

function stopAnimate() {
    clearTimeout(interval);
}

【问题讨论】:

  • 没有任何效果:/ IE 不应该被任何人使用!有人出主意吗?

标签: jquery internet-explorer hover z-index


【解决方案1】:

Z-Indexing 很奇怪,因为在 IE 中没有更合适的词。

长话短说,要在 IE 中正确使用 z-indexing,涉及的每个元素(从父级到子级)都必须有一个 z-index(有时一直回到正文)。

这里的这个问题很好地回答了这个问题: IE7 Z-Index Layering Issues

【讨论】:

  • 我将隔离代码并根据您的建议对其进行测试并让您知道结果
  • 嗯,感谢您的出色回答,但我无法解决这个问题:/
  • 你能发布你的 JS 代码,或者至少是处理悬停的部分吗?由于 IE 做了一个站点,该站点有一个扩展菜单,该菜单覆盖了一个旋转的图像显示(不涉及 Flash,所有 HTML、CSS 和 JavaScript),我曾经差点把头发扯掉,最终这就是解决方案。我想你的也是一样的,我知道你会像我在它最终解决时那样呼吸更轻松!
  • 我更新了我的问题并添加了 JS 代码(还有一个指向整个脚本的链接更高一点)
  • 发现问题:您必须在 Internet Explorer 中设置背景颜色。这里的修复:背景颜色:#fff;过滤器:alpha(opacity=1);
猜你喜欢
  • 2011-03-22
  • 1970-01-01
  • 2010-11-12
  • 2011-11-28
  • 1970-01-01
  • 2013-06-25
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多