1
我有這個代碼簡單位:只能通過jQuery.fn.myPlugin()而不是jQuery.myPlugin()訪問jQuery插件嗎?
(function($) {
$.fn.flyInModal = function() {
alert('fly in?');
};
})(jQuery);
我可以做jQuery.fn.flyInModal()
從控制檯訪問它,但如果我嘗試jQuery.flyInModal()
它只返回:
TypeError: Object function (e,t){return new v.fn.init(e,t,n)} has no method 'flyInModal'
編輯:jQuery.prototype.flyInModal()
也有效。
通讀the doc我應該可以通過這種方式訪問它。我錯過了什麼嗎?
哦,這清除了事情!謝謝,我會在幾分鐘內接受! – qwerty 2013-02-16 13:23:19