2011-05-31 61 views
0

我是Jquery和插件世界的新手。我一直在试用与这里解释的serialscroll插件 - http://flesler.blogspot.com/2008/02/jqueryserialscroll.html。我有这个简单的代码定义的参数:jquery插件调用与IE8不兼容

jQuery(function($){ 

     $('#screen').serialScroll({ 
     target:'#sections', 
     items:'li', 
     axis:'xy', 
     navigation:'#navigation li a', 
     duration:700, 
     force:true, 
      }); 
    }); 

完美适用于除IE8以外的所有浏览器。给出一个错误“Jquery not defined line 1 char 1.”显然我有最新的外部serialscroll.js文件,所以我知道这不是问题。 IE8不满意的语法是什么?

下面是完整的代码:

JQUERY:

// Easing equation, borrowed from jQuery easing plugin 
// http://gsgd.co.uk/sandbox/jquery/easing/ 
jQuery.easing.easeOutQuart = function (x, t, b, c, d) { 
    return -c * ((t=t/d-1)*t*t*t - 1) + b; 
}; 

jQuery(function($){ 

    $('#screen').serialScroll({ 
     target:'#sections', 
     items:'li', 
     axis:'xy', 
     navigation:'#navigation li a', 
     duration:700, 
     force:true, 
     onBefore:function(e, elem, $pane, $items, pos){ 
      e.preventDefault(); 
      if(this.blur) 
       this.blur(); 
     }, 
     onAfter:function(elem){ 

     } 
    }); 
}); 

CSS:

#screen{ 
    position:relative; 
    height:700px; 
    width:925px; 
    margin-top:40px; 
    } 
#navigation{ 
    position:absolute; 
    width:883px; 
    height:77px; 
    z-index:3; 
    left: 84px; 
    top: -17px; 
     } 
     #navigation ul{ 
      margin-left:10px !important; 

     } 
      #navigation li{ 
       float:left; 
       padding-left:35px; 


      } 
       #navigation a{ 
        font-weight:bolder; 
        text-decoration:none; 
        padding-left:25px; 
        float:left; 
       } 

#sections{ 
    position:absolute; 
    overflow: hidden; 
    width:510px; 
    height:510px; 
    z-index:3; 
    left: 169px; 
    top: 205px; 
} 

    #sections ul{ 
     width:3660px; 
      } 

     #sections li{ 
      left: 0px; 
      top: 0px; 
      padding-left:0; 
      margin-left:0; 
     } 
     #sections p{ 
       width:550px; 
       margin:16px 0; 
       font-size:85%; 
       line-height:1.4em;} 

HTML:

<div id="screen"> 

<div id="navigation"> 
<ul> 
<li><a href="#">Link 1</a></li> 
<li><a href="#">Link 2</a></li> 
<li><a href="#">Link 3</a></li> 
<li><a href="#">Link 4</a></li> 
</div> 

<div id="sections"><ul> 
<li><p>some text</p></li> 
<li><p>some text</p></li> 
<li><p>some text</p></li> 
<li><p>some text</p></li> 
</ul></div> 

</div> 

回答

2

删除就行了force:true,后面的逗号(所以 读取force:true) - Internet Explorer不喜欢稍后有逗号但没有其他属性时。

+0

@Nathan Anderson,摆脱了逗号,但仍然没有去。给出同样的错误“Jquery未定义行1字符1”。 – 2011-05-31 17:57:39

+0

其他地方几乎肯定会出现类似的javascript语法错误。 IE对JS语法的要求比其他浏览器要严格得多。寻找额外的逗号,缺少分号,类似的东西。 – 2011-05-31 18:47:45

+0

我同意@jamietre。如果可能的话,请将您的完整页面发布到可以审查的地方。 – 2011-05-31 20:18:31