- ·上一篇文章:jQuery UI 部件库(Widget Factory)
- ·下一篇文章:jQuery UI 小部件(Widget)方法调用
当前位置:K88软件开发 → 文章中心 → 编程语言 → JavaScript → JS02 → 文章内容
jQuery UI 通过部件库(Widget Factory)扩展小部件
为。为了做到这点,您需要使用正常的 JavaScript 属性分配,获得对实例的引用,并重载该方法。具体如下面实例所示。var dialogInstance = $( "<div>" ) .dialog() // Retrieve the dialog's instance and store it. .data( "ui-dialog" ); // Override the close() method for this dialogdialogInstance.close = function() { console.log( "close" );}; // Create a second dialog$( "<div>" ).dialog(); // Select both dialogs and call close() on each of them.// "close" will only be logged once.$( ":
data(ui-dialog)" ).dialog( "close" );个性化实例的重载方法技术是完美的一次性定制。
data(ui-dialog)" ).dialog( "close" );个性化实例的重载方法技术是完美的一次性定制。
jQuery UI 通过部件库(Widget Factory)扩展小部件