comunic/assets/js/metro/metro-panel.js

42 lines
1.0 KiB
JavaScript
Raw Permalink Normal View History

2016-11-19 11:08:12 +00:00
(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 );