2013-03-22 110 views
-2

我從來沒有見過這之前:未捕獲的SyntaxError:意外的標記:在jQuery定義中?

enter image description here

<script type="text/javascript"> 
    $(document).ready(function() { 
    $('#js-news').ticker(
     speed: 0.10,   // The speed of the reveal 
     ajaxFeed: false,  // Populate jQuery News Ticker via a feed 
     feedUrl: false,  // The URL of the feed 
         // MUST BE ON THE SAME DOMAIN AS THE TICKER 
     feedType: 'xml',  // Currently only XML 
     htmlFeed: true,  // Populate jQuery News Ticker via HTML 
     debugMode: true,  // Show some helpful errors in the console or as alerts 
         // SHOULD BE SET TO FALSE FOR PRODUCTION SITES! 
     controls: true,  // Whether or not to show the jQuery News Ticker controls 
     titleText: 'Latest', // To remove the title set this to an empty String 
     displayType: 'reveal', // Animation type - current options are 'reveal' or 'fade' 
     direction: 'ltr'  // Ticker direction - current options are 'ltr' or 'rtl' 
     pauseOnItems: 2000, // The pause on a news item before being replaced 
     fadeInSpeed: 600,  // Speed of fade in animation 
     fadeOutSpeed: 300  // Speed of fade out animation 
    ); 
    }); 
</script> 

該代碼是</head>之前。幷包含jQuery

可能是什麼問題?

回答

2

可能在股票缺少{}

<script type="text/javascript"> 
    $(document).ready(function() { 
    $('#js-news').ticker({ 
      speed: 0.10,   // The speed of the reveal 
      ajaxFeed: false,  // Populate jQuery News Ticker via a feed 
      direction: 'ltr' 
      ...........//--^-------missing ',' 
      fadeOutSpeed: 300  // Speed of fade out animation 
    }); 
    }); 
</script> 

另外,作爲對方的回答提出了失蹤,direction: 'ltr'

+0

+1,首先確定** main **問題。不過,其他人對於錯過的逗號也是正確的。 – 2013-03-22 07:40:12

+0

+1,好眼睛!!! – adeneo 2013-03-22 07:40:33

+0

謝謝你們!只是首先注意到了。 – Jai 2013-03-22 07:41:49

1

你錯過了,direction: 'ltr'

+0

我加了逗號,但仍具有相同錯誤。 – alexchenco 2013-03-22 07:41:04

相關問題