Flyer53 / jsPanel

A jQuery Plugin to create highly configurable floating panels, modals, tooltips and hints/notifiers for use in a backend solution and other web applications.
http://v2.jspanel.de/
Other
163 stars 56 forks source link

How can I remove the maximize, smallify button from jsPanel Controls? #37

Closed kouennrin closed 9 years ago

kouennrin commented 9 years ago

I tried many ways, but not able to hide those functions. Please help ,Thanks!

Flyer53 commented 9 years ago

Hi there, With remove, do you really mean remove them completely from the panel (from the DOM)? That would mean only the close and minimize/normalize controls would remain. If that's what you intend you can do this via the callback when creating the panel as follows:

$.jsPanel({
  callback: function(panel){
    $(".jsPanel-btn-max, .jsPanel-btn-small, .jsPanel-btn-smallrev", panel.header.controls).remove();
    // more callback routines as needed ...
  }
});

If you need more panels without those controls by default you could use option.template as follows:

function templateOne() {
    // copy standard template
    var template = $(jsPanel.template);
    // select controls section of copied template
    var controls = $('.jsPanel-hdr-r', template);
    // remove controls from template
    $(".jsPanel-btn-max, .jsPanel-btn-small, .jsPanel-btn-smallrev", controls).remove();
    // and return the new template
    return template;
}

// call .jsPanel(); with option.template
$.jsPanel({
    template: templateOne(),
    position: 'center',
    theme:    'light',
    callback: function (panel) {
        // whatever you need ...
    }
});

Hope I could help?

kouennrin commented 9 years ago

Thank you very much, as you said this issue is resolved. jsPanel is a very great and useful library.