components_dropdowns.js 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. /* ------------------------------------------------------------------------------
  2. *
  3. * # Bootstrap dropdowns
  4. *
  5. * Demo configuration of Dropdown component showcase
  6. *
  7. * ---------------------------------------------------------------------------- */
  8. // Setup module
  9. // ------------------------------
  10. var Dropdowns = function () {
  11. //
  12. // Setup module components
  13. //
  14. // Switchery
  15. var _componentSwitchery = function() {
  16. if (typeof Switchery == 'undefined') {
  17. console.warn('Warning - switchery.min.js is not loaded.');
  18. return;
  19. }
  20. // Initialize multiple switches
  21. var toggle = Array.prototype.slice.call(document.querySelectorAll('.form-input-switchery'));
  22. toggle.forEach(function(html) {
  23. var switchery = new Switchery(html);
  24. });
  25. };
  26. // Uniform
  27. var _componentUniform = function() {
  28. if (!$().uniform) {
  29. console.warn('Warning - uniform.min.js is not loaded.');
  30. return;
  31. }
  32. // Initialize
  33. $('.form-input-styled').uniform();
  34. };
  35. //
  36. // Return objects assigned to module
  37. //
  38. return {
  39. initComponents: function() {
  40. _componentSwitchery();
  41. _componentUniform();
  42. }
  43. }
  44. }();
  45. // Initialize module
  46. // ------------------------------
  47. document.addEventListener('DOMContentLoaded', function() {
  48. Dropdowns.initComponents();
  49. });