【发布时间】:2014-01-14 15:39:42
【问题描述】:
在以下代码中,带有锚点的第一张和第二张图像具有链接,并且在这些图像中,标题文本不会在 IE 6 / IE7 或 IE8 Comp 模式下的页面加载时隐藏(不透明度 0)。所有其他图像都可以正常工作,但我需要在其中添加链接。
这是JSfiddle中的代码
FF 可以正常工作,IE8 在普通模式下也可以
我会在这里发布整个代码,但它相当长,而且我在这样做时遇到了麻烦。
添加 js 代码
$(window).load(function(){
//for each description div...
$('div.description').each(function(){
//...set the opacity to 0...
$(this).css('opacity', 0);
//..set width same as the image...
$(this).css('width', $(this).siblings('img').width());
//...get the parent (the wrapper) and set it's width same as the image width... '
$(this).parent().css('width', $(this).siblings('img').width());
//...set the display to block
$(this).css('display', 'inline-block');
});
$('div.wrapper').hover(function(){
//when mouse hover over the wrapper div
//get it's children elements with class descriptio
//and show it using fadeTo
//$(this).children('.description').show();
$(this).children('.description').stop().fadeTo(500, 0.7);
},function(){
//when mouse out of the wrapper div
//use fadeTo to hide the div
$(this).children('.description').stop().fadeTo(500, 0);
});
});
好像不是这样的……
$(this).css('opacity', 0);
【问题讨论】:
标签: jquery internet-explorer-7 internet-explorer-6 ie8-compatibility-mode