Difference between revisions of "Team:NCHU Taichung/js/main.js"

 
Line 31: Line 31:
 
     };
 
     };
 
   $menuItem.on('click', handler.activate);
 
   $menuItem.on('click', handler.activate);
 +
  $('.accordion').accordion('open', 0);
 +
  $('#articleTemplate').remove();
 
});
 
});

Latest revision as of 19:40, 15 October 2018

$(document).ready(function () {

 $('#openSidebar').on("click", function (e) {
   e.preventDefault();
   $('#sidemenu').toggle();
   $('body, html').animate({
     scrollTop: 0                       // Scroll to top of body
   }, 500);
 });
 $('.ui.sticky').sticky({
   context: '#mainbox'
 });
 $('.ui.dropdown').dropdown();
 var
   $dropdownItem = $('.main.container .menu .dropdown .item'), 
   $menuItem = $('.main.container .menu a.item, .menu .link.item').not($dropdownItem),
   // alias
   handler = {
     activate: function () {
       if (!$(this).hasClass('dropdown browse')) {
         $(this)
           .addClass('active')
           .closest('.ui.menu')
           .find('.item')
           .not($(this))
           .removeClass('active')
           ;
       }
     }
   };
 $menuItem.on('click', handler.activate);
 $('.accordion').accordion('open', 0);
 $('#articleTemplate').remove();

});