除了在IE7中,简单的jQuery看起来很好

时间:2010-10-18 12:55:29

标签: javascript jquery

我使用jQuery和mouseenter / mouseleave创建了一个简单的动画。它在IE7,FF,Opera,Chrome和Safari中运行良好。

然而,在IE7中出现了问题 - 根本没有任何反应 - 我甚至无法弹出警报框。

有人可以看一看我的代码,然后告诉我,在我脱掉头发之前我做错了什么。

可以在www.ypfservice.net上查看违规页面 - 它是joomla安装的一部分,因此代码臃肿。

非常感谢

电子

enter code here$('a.panelImage').parent().addClass('panel');      

 var numberLinks = $('a.panelImage').length;

 for (var j=0; j<numberLinks; j++){

var currentLink = $('a.panelImage').eq(j);          

$('<div class="fred"></div>').insertAfter(currentLink);

var gtr=(currentLink.position().left)+'px';

 $(currentLink).next().css({ // ie div.fred
    'position':'absolute',
    'background-position':'0 0',
    'top':'222px',
    'left':gtr,
    'display':'none',
    'z-index':'1000',
    'width':'5px',
    'height':'5px',
    'overflow':'hidden',
    'backgroundImage':'url(http://www.ypfservice.net/templates/ypftemplate/images/foyerPreview.jpg)',
       });

 }

 $('div.panel').mouseenter(function () {

 $(this).find('div').animate({          
       height: '138px', 
       width: '184px' 
    }, 500)     
})
.mouseleave(function () { 
    $(this).find('div').animate({ 
       'width': '0px', 
       'height': '0px' 
    }, 500); 
}); //end function 

1 个答案:

答案 0 :(得分:8)

邪恶的Microsoft 逗号带给你!!

 'backgroundImage':'url(http://www.ypfservice.net/templates/ypftemplate/images/foyerPreview.jpg)',

,,,,,,, 他们来拥有我们! 逗号无处不在,他们在这里制作 程序员疯了!的 ,,,

对象文字中的尾随逗号是一件坏事。 ,,,