mirror of
https://github.com/pierre42100/comunic
synced 2024-11-16 18:41:13 +00:00
42 lines
1.0 KiB
JavaScript
42 lines
1.0 KiB
JavaScript
|
(function( $ ) {
|
||
|
$.widget("metro.panel", {
|
||
|
|
||
|
version: "1.0.0",
|
||
|
|
||
|
options: {
|
||
|
onCollapse: function(){},
|
||
|
onExpand: function(){}
|
||
|
},
|
||
|
|
||
|
_create: function(){
|
||
|
var element = this.element, o = this.options,
|
||
|
header = element.children('.panel-header'),
|
||
|
content = element.children('.panel-content');
|
||
|
|
||
|
header.on('click', function(){
|
||
|
content.slideToggle(
|
||
|
'fast',
|
||
|
function(){
|
||
|
element.toggleClass('collapsed');
|
||
|
if (element.hasClass('collapsed')) {
|
||
|
o.onCollapse();
|
||
|
} else {
|
||
|
o.onExpand();
|
||
|
}
|
||
|
}
|
||
|
);
|
||
|
});
|
||
|
},
|
||
|
|
||
|
_destroy: function(){
|
||
|
|
||
|
},
|
||
|
|
||
|
_setOption: function(key, value){
|
||
|
this._super('_setOption', key, value);
|
||
|
}
|
||
|
})
|
||
|
})( jQuery );
|
||
|
|
||
|
|