2010-09-14 58 views
0

下面是我尝试使用的jQuery代码。它适用于Firefox,Opera,Chrome,Safari,但不支持IE7。我最初怀疑这是因为:hidden选择器在IE7中不被支持,所以我试图简单地.show()和.fadeIn()该元素没有条件(你可以从注释掉的区域看到这一点)。jQuery .show,.fadeIn与IE7不可见

if (data.indexOf(error) == -1){ 
    alert('in result'); 
    if ($('.result').is(":hidden") == true){ 
    alert('in fade in'); 
    $('.result').fadeIn('slow'); 
    } 
    //$('.result').show('slow'); 
    $('.result span #entry').html(data); 
    alert('entered data'); 

但是这没有被证明是成功的。即使没有条件选择器,我仍然无法让元素出现在IE7中。但我知道它正在解释代码,因为'结果'和'输入数据'警报都被抛出。

这里的XHTML

<div class='result'> 
<img src='content/red-x.gif' alt='close' /> 
<span id='entry'></span> 
</div> 

和CSS

.result { 
display: none; 
background: #c9fd9b; 
background: -webkit-gradient(
    linear, 
    left bottom, 
    left top, 
    color-stop(0.51, rgb(201,253,155)), 
    color-stop(0.85, rgb(217,245,191)), 
    color-stop(0.24, rgb(193,240,149)), 
    color-stop(0.11, rgb(177,222,136)) 
); 
background: -moz-linear-gradient(
    center bottom, 
    rgb(201,253,155) 51%, 
    rgb(217,245,191) 85%, 
    rgb(193,240,149) 24%, 
    rgb(177,222,136) 11%)); 
z-index: 22; 
width: 255px; 
height: 155px; 
position: fixed; 
left: 50%; 
top: 65px; 
overflow: hidden; 
padding: 10px; 
margin: 5px; 
margin-left: -127.5px; 


-webkit-border-radius: 10px; 
-moz-border-radius: 10px; 
border-radius: 10px; 

box-shadow: 2px 2px 10px #333333; 
-moz-box-shadow: 2px 2px 10px #333333; 
-webkit-box-shadow: 2px 2px 10px #333333; 
} 
+0

如果你包含你的代码的http://jsfiddle.net链接,调试它们会容易得多。 – 2010-09-14 17:28:13

+0

了解,但是这种情况没有足够的模块化来将独立的代码放置在jsfiddle中。 – 2010-09-14 17:31:34

回答

0

在IE开发工具栏只看到后控制是可见的,由于淡化它添加一些代码不透明度效果。通过书写删除这段代码

$('selector').css('attribute',''); 或写入 $('selector')。removeAttr('style'); //删除所有内联样式。

希望这会帮助你:)