2016-03-18 44 views
0

之前,我得到缺少jQuery插件;声明(jQuery的)

SyntaxError: missing ; before statement }) (jQuery);

在下面的代码

。我试图做一个jQuery插件,我看不出有什么错在这里:

(function($) { 
$.fn.hideElement = function(options) { 
    options = $.extend({}, $.fn.hideElement.defaults, options); 

    return this.each(function(){ 
    var wrapping = $(this).css('white-space'); 
    $(this).css({'white-space':'nowrap'}) 
     .animate(options.toggling,1000, function(){ 
     $('<p>').text('»') 
      .insertAfter($(this)) 
      .click(function(){ 
      $(this).prev() 
      .animate(options.toggling,1000) 
      .css({'white-space':wrapping}) 
      .next().remove(); 
     }); 
    }); 
    }); 
    $.fn.hideElement.defaults = { 
    'toggling':'width', 
    } 
}) (jQuery); 
+1

'$ .fn.hideElement =功能(选件){'未关闭。在}}(jQuery)前添加'}';' – Popnoodles

回答

2

你撑标签是不平衡所以不容易被发现。

$.fn.hideElement = function(options) {未关闭。

添加另一个}}) (jQuery);

+0

当我添加闭包时,完全错过了!谢谢! – Sluggo