我越来越
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);
最佳答案
支撑标签不平衡,因此不容易发现。$.fn.hideElement = function(options) {
没有关闭。
在}
之前添加另一个}) (jQuery);
关于jquery - jQuery插件丢失;声明前(jQuery),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36084426/