0

我想简单地在滑块内缓慢更改每个项目的不透明度,除了我悬停的项目。它在 chrome 中完美运行,但在 Internet Explorer 8 和 7 中都无法运行。

这是html代码:

        <div id="carousel-image-and-text" class="touchcarousel carousel-image-and-text clearfix" style="overflow: visible; ">
            <div class="touchcarousel-wrapper grab-cursor">
                <ul id="weekly-promos" class="touchcarousel-container" style="width: 1420px; left: 0px; ">
                    <asp:Repeater ID="RList" runat="server">
                        <ItemTemplate>
                            <li class="touchcarousel-item">
                                <a class="item-block" href="Article.aspx?PageID=<%# Eval("PageID") %>" rel="tooltip-<%# Eval("PageID") %>">
                                <figure><img src="<%# SetConf(Eval("PageID").ToString(),false) %><%# Eval("VisualSource") %>"></figure>
                                </a>
                            </li>
                        </ItemTemplate>
                    </asp:Repeater>
                </ul>
            </div>

这是javascript部分:

 $(".carousel-slider a img").hover(function () {
            $(".carousel-slider img").not(this).stop().animate({ opacity: '0.4', filter: 'alpha(opacity=40)' }, 1000);

        }, function () {
            $(".carousel-slider img").not(this).stop().animate({ opacity: '1.0', filter: 'alpha(opacity=100)' }, 1000);
        });
4

1 回答 1

1

不要使用过滤器,只使用不透明度:

$(".carousel-slider a img").hover(function () {
  $(".carousel-slider img").not(this).stop().animate({ opacity: 0.4 }, 500);
}, function () {
  $(".carousel-slider img").not(this).stop().animate({ opacity: 1.0 }, 500);
});
于 2012-10-15T11:49:26.513 回答