【发布时间】:2014-03-31 14:55:32
【问题描述】:
我有以下 HTML:
<td class="tdGo" style="background-color: #0000FF;">
<img src="theImages/search_go.png" id="imgGo" class="imgGo" />
</td>
CSS:
td.tdGo {
padding-right: 24px;
text-align: right;
}
.imgGo {
cursor: pointer;
}
JQuery:
$('.imgGo').each(function() {
var std = $(this).attr("src");
var hover = std.replace("theImages/search_go.png", "theImages/search_go_rollover.png");
$(this)
.clone()
.insertAfter(this)
.attr('src',hover)
.removeClass('imgGo')
.siblings()
.css({position:'absolute'});
$(this)
.mouseenter(function() {
$(this).stop().fadeTo(250, 0);
})
.mouseleave(function() {
$(this).stop().fadeTo(250, 1);
});
});
IE10:
IE8:
FF/铬:
由于某种原因,在 IE10 中,图像出现在两个不同的位置,我似乎无法弄清楚为什么。任何帮助表示赞赏。
这是 DEV 工具显示的内容:
【问题讨论】:
-
您检查过浏览器工具中呈现的 CSS 吗?
-
我用开发工具截图更新了我的问题。
-
这是一种非常时髦的翻转方式。该问题一定是您使用
clone()引起的。 -
你为什么不在 CSS 中做这个?无需使用 JavaScript 进行翻转。
-
我希望在所有浏览器中都支持
标签: jquery html css internet-explorer-8 internet-explorer-10