...
- Create a new CSS file on your server called PanelStyles.css.
Add the following CSS to the file, and save it to the GlobalForms\client\dist\view folder on the server.
Code Block language css title PanelStyles.css .clickable{ cursor: pointer; } .panel-heading span { margin-top: -20px; font-size: 15px; }
Create a new Javascript file on your server, called panleLogic.js.
Add the following Javascript to the file, and save it to the GlobalForms\client\dist\view folder on the server.
Code Block language js title panelLogic.js jQuery(document).ready(function(){ jQuery(".panel-body-open .panel-heading").append("<span class='pull-right clickable'><i class='glyphicon glyphicon-chevron-up'></i></span>"); jQuery(".panel-body-closed .panel-heading").append("<span class='pull-right clickable panel-collapsed'><i class='glyphicon glyphicon-chevron-down'></i></span>"); jQuery(".panel-body-closed .panel-body").addClass('collapse'); //Collapse specific panels by default. }); jQuery(document).on('click', '.panel-heading span.clickable', function(e){ var $panel = jQuery(this); if(!$panel.hasClass('panel-collapsed')) { $panel.parents('.panel').find('.panel-body').slideUp(); $panel.addClass('panel-collapsed'); $panel.find('i').removeClass('glyphicon-chevron-up').addClass('glyphicon-chevron-down'); } else { $panel.parents('.panel').find('.panel-body').slideDown(); $panel.removeClass('panel-collapsed'); $panel.find('i').removeClass('glyphicon-chevron-down').addClass('glyphicon-chevron-up'); } }) ;
With the Javascript and CSS saved to the server, collapsing functionality can be added to any GlobalForms simply by adding references to the files.