2013-10-01 49 views
-2

IE8错误:IE 8的错误:消息:预期 '}'

Message: Expected '}' 

Line: 59 

线:59,其中第二实例位于----->($ magicLineTwo.stop()动画({ )

$("#example-two li").find("a").hover(function() { 
     $el = $(this); 
     leftPos = $el.position().left; 
     newWidth = $el.parent().width(); 
     $magicLineTwo.stop().animate({   
      left: leftPos,   
      width: newWidth 
      backgroundColor: $el.attr("rel") 
     }); 

整个JavaScript代码可以在这里找到JSFiddle

我将不胜感激,如果有人能帮助我,周一直停留在此。

+0

为什么任何Web开发人员使用IE8? O_O使用所有的浏览器 – Doorknob

+0

,公正,以确保它们都正常运行较好,但在IE8这个黄色的错误图标是一个重大问题:( – Sol

回答

3

嗯,你错过了在这里逗号:

left: leftPos, 
    width: newWidth 
    backgroundColor: $el.attr("rel") 

它应该是这样的:

left: leftPos, 
    width: newWidth, 
    backgroundColor: $el.attr("rel") 
+5

你的意思是一个逗号? – MikeSmithDev

+0

是的,我指的是逗号,谢谢:)我更新回答 – adamziel

2

将一个逗号这里:

left: leftPos, 
width: newWidth 
      ^
backgroundColor: $el.attr("rel") 
+0

我把逗号的那一刻,我得到另一个错误在IE8中,“位置()。左”为空或不是对象------------> $ magicLineTwo – Sol

+0

那是什么错误? –

+0

问题是,我无法测试它,因为我有IE 10和它在所有模式下都能正常工作。 ':(' –

相关问题