未捕获的SyntaxError:意外的令牌:在jQuery定义中?

时间:2013-03-22 07:36:06

标签: 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 个答案:

答案 0 :(得分: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'

答案 1 :(得分:1)

您错过了,

之后的direction: 'ltr'