jcv*_*gan 6 jquery jquery-ui jquery-plugins
我想使用jquery ui框架创建一个控件.我知道我必须使用jquery.ui.widget.js作为工厂的基础.
我想要创建的此控件具有类似于tabcontrol的行为.我想创建一个tileview,所以当你在一个多个视图的面板中选择一个内容时......它会扩展,其他的会折叠到控件的一侧.喜欢这个http://demos.telerik.com/silverlight/#TileView/FirstLook 是否有任何教程,一步一步创建自定义小部件?
一个很好的起点是关于这个主题的jQuery UI文档:http://wiki.jqueryui.com/w/page/12138135/Widget-factory
您的小部件至少必须实现以下代码(从文档中获取的示例):
(function( $ ) {
$.widget( "demo.multi", {
// These options will be used as defaults
options: {
clear: null
},
// Set up the widget
_create: function() {
},
// Use the _setOption method to respond to changes to options
_setOption: function( key, value ) {
switch( key ) {
case "clear":
// handle changes to clear option
break;
}
// In jQuery UI 1.8, you have to manually invoke the _setOption method from the base widget
$.Widget.prototype._setOption.apply( this, arguments );
// In jQuery UI 1.9 and above, you use the _super method instead
this._super( "_setOption", key, value );
},
// Use the destroy method to clean up any modifications your widget has made to the DOM
destroy: function() {
// In jQuery UI 1.8, you must invoke the destroy method from the base widget
$.Widget.prototype.destroy.call( this );
// In jQuery UI 1.9 and above, you would define _destroy instead of destroy and not call the base method
}
});
}( jQuery ) );
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
9695 次 |
| 最近记录: |