开发者

How to rename a jQuery function

开发者 https://www.devze.com 2023-02-14 13:52 出处:网络
How do we rename a jquery function. let\'s say i want to rename the Jquery UI function draggble() to xdraggble() so that it does not conflict with another draggable function loaded from anot开发者_Pyt

How do we rename a jquery function. let's say i want to rename the Jquery UI function draggble() to xdraggble() so that it does not conflict with another draggable function loaded from anot开发者_Python百科her library. Does renaming affect performance.


Something like this, executed before the other script loads:

jQuery.fn.xdraggable = jQuery.fn.draggable;


var xdraggable = $.fn.draggable;
//or
var xdraggable = $.draggable;

(depending implementation)

Same as what you'd do if you wanted to override the function but still have access.

See this post regarding what I mean by overriding

0

精彩评论

暂无评论...
验证码 换一张
取 消