JAVASCRIPT   29
application
Guest on 27th August 2023 11:58:05 AM


  1. !function ($) {
  2.  
  3.   $(function(){
  4.  
  5.     // Disable links in docs
  6.     $('[href^=#]').click(function (e) {
  7.       e.preventDefault()
  8.     })
  9.  
  10.     /////////////////////////////
  11.     // ACCORDION ICON TOGGLE
  12.     /////////////////////////////
  13.     var iconOpen = 'fa-minus',
  14.         iconClose = 'fa-plus';
  15.  
  16.     $(document).on('show.bs.collapse hide.bs.collapse', '.accordion', function (e) {
  17.         var $target = $(e.target)
  18.           $target.siblings('.accordion-heading')
  19.           .find('em').toggleClass(iconOpen + ' ' + iconClose);
  20.           if(e.type == 'show')
  21.               $target.prev('.accordion-heading').find('.accordion-toggle').addClass('active');
  22.           if(e.type == 'hide')
  23.               $(this).find('.accordion-toggle').not($target).removeClass('active');
  24.     });
  25.  
  26.  
  27.     /////////////////////////////
  28.     // TYPEAHEAD (autocomplete)
  29.     /////////////////////////////
  30.  
  31.     /* Bootstrap 3 doesn't include typeahead so*/
  32.     $('[data-provide="typeahead"]').typeahead({
  33.       name: "states",
  34.       local: ["Alabama","Alaska","Arizona","Arkansas","California","Colorado","Connecticut","Delaware","Florida","Georgia","Hawaii","Idaho","Illinois","Indiana","Iowa","Kansas","Kentucky","Louisiana","Maine","Maryland","Massachusetts","Michigan","Minnesota","Mississippi","Missouri","Montana","Nebraska","Nevada","New Hampshire","New Jersey","New Mexico","New York","North Dakota","North Carolina","Ohio","Oklahoma","Oregon","Pennsylvania","Rhode Island","South Carolina","South Dakota","Tennessee","Texas","Utah","Vermont","Virginia","Washington","West Virginia","Wisconsin","Wyoming"],
  35.       limit: 4
  36.     });
  37.  
  38.  
  39.  
  40.     // tooltip demo
  41.     $("[data-toggle=tooltip]").tooltip();
  42.  
  43.     // popover demo
  44.     $("[data-toggle=popover]")
  45.       .popover()
  46.  
  47.     // button state demo
  48.     $('#fat-btn')
  49.       .click(function () {
  50.         var btn = $(this)
  51.         btn.button('loading')
  52.         setTimeout(function () {
  53.           btn.button('reset')
  54.         }, 3000)
  55.       })
  56.  
  57.     // carousel demo
  58.     $('#myCarousel').carousel();
  59.     $('#myCarouselV').carousel();
  60.  
  61.   })
  62. }(window.jQuery)

Raw Paste

Login or Register to edit or fork this paste. It's free.