/* global plugin loader method, call this on document ready and modal load to ensure jquery/bootstrap plugins are loaded/rendered properly */ $.fn.loadPlugins = function() { // uniform controls if(!$.uniform.elements.length){ // load uniform on main page $('.workplace').find('input:checkbox, input:radio, input:file').not('.skip, input.ibtn').uniform(); } else{ // load uniform on modal window $('.modal-body').find('input:checkbox, input:radio, input:file').not('.skip, input.ibtn').uniform(); $('.modal-body').find('.checker, .radio').removeAttr('style'); } /***** you can load other classes here: for example *****/ // tabs $('.tabs').tabs(); // bootstrap tool tips $('.tip').tooltip({placement:'top', trigger:'hover'}); $('.tipb').tooltip({placement:'bottom', trigger:'hover'}); $('.tipl').tooltip({placement:'left', trigger:'hover'}); $('.tipr').tooltip({placement:'right', trigger:'hover'}); // make this function call chainable by returning instance return this; } /* document ready global routines */ $(document).ready(function(){ // on document load, load plugins $(document.body).loadPlugins(); // apply this to any bootstrap modal container (recommend using a single reusable container) $('#modalContainer').on('show', function(e){ $(e.target).loadPlugins(); }); });