SHOW:
|
|
- or go back to the newest paste.
1 | /* | |
2 | global plugin loader method, | |
3 | call this on document ready and modal load to ensure jquery/bootstrap plugins are loaded/rendered properly | |
4 | */ | |
5 | $.fn.loadPlugins = function() | |
6 | { | |
7 | // uniform controls | |
8 | if(!$.uniform.elements.length){ | |
9 | // load uniform on main page | |
10 | $('.workplace').find('input:checkbox, input:radio, input:file').not('.skip, input.ibtn').uniform(); | |
11 | } | |
12 | else{ | |
13 | // load uniform on modal window | |
14 | $('.modal-body').find('input:checkbox, input:radio, input:file').not('.skip, input.ibtn').uniform(); | |
15 | $('.modal-body').find('.checker, .radio').removeAttr('style'); | |
16 | } | |
17 | ||
18 | /***** you can load other classes here: for example *****/ | |
19 | ||
20 | // tabs | |
21 | $('.tabs').tabs(); | |
22 | ||
23 | // bootstrap tool tips | |
24 | $('.tip').tooltip({placement:'top', trigger:'hover'}); | |
25 | $('.tipb').tooltip({placement:'bottom', trigger:'hover'}); | |
26 | $('.tipl').tooltip({placement:'left', trigger:'hover'}); | |
27 | $('.tipr').tooltip({placement:'right', trigger:'hover'}); | |
28 | ||
29 | // make this function call chainable by returning instance | |
30 | return this; | |
31 | } | |
32 | ||
33 | /* | |
34 | document ready global routines | |
35 | */ | |
36 | $(document).ready(function(){ | |
37 | ||
38 | // on document load, load plugins | |
39 | $(document.body).loadPlugins(); | |
40 | ||
41 | // apply this to any bootstrap modal container (recommend using a single reusable container) | |
42 | $('#modalContainer').on('show', function(e){ | |
43 | $(e.target).loadPlugins(); | |
44 | }); | |
45 | ||
46 | }); |