Difference between revisions of "Template:Harvard BioDesign/JS Scroll0"

 
(5 intermediate revisions by the same user not shown)
Line 20: Line 20:
 
       $body = $('body');
 
       $body = $('body');
  
    // Disable animations/transitions until the page has loaded.
+
    //Disable animations/transitions until the page has loaded.
    //  $body.addClass('is-loading');
+
      $body.addClass('is-loading');
  
       //$window.on('load', function() {
+
       $window.on('load', function() {
         //$body.removeClass('is-loading');
+
         $body.removeClass('is-loading');
       //});
+
       });
  
 
     // CSS polyfills (IE<9).
 
     // CSS polyfills (IE<9).
Line 58: Line 58:
 
             if (href[0] != '#')
 
             if (href[0] != '#')
 
               return;
 
               return;
 
+
             
 
             e.preventDefault();
 
             e.preventDefault();
  
Line 100: Line 100:
 
         $('#header')
 
         $('#header')
 
           .panel({
 
           .panel({
             delay: 500,
+
             delay: 300,
 
             hideOnClick: true,
 
             hideOnClick: true,
 
             hideOnSwipe: true,
 
             hideOnSwipe: true,

Latest revision as of 15:41, 24 July 2015

/*

 Prologue by HTML5 UP
 html5up.net | @n33co
 Free for personal and commercial use under the CCA 3.0 license (html5up.net/license)
  • /

(function($) {

 skel.breakpoints({
   wide: '(min-width: 961px) and (max-width: 1880px)',
   normal: '(min-width: 961px) and (max-width: 1620px)',
   narrow: '(min-width: 961px) and (max-width: 1320px)',
   narrower: '(max-width: 960px)',
   mobile: '(max-width: 736px)'
 });
 $(function() {
   var  $window = $(window),
     $body = $('body');
    //Disable animations/transitions until the page has loaded.
     $body.addClass('is-loading');
     $window.on('load', function() {
       $body.removeClass('is-loading');
     });
   // CSS polyfills (IE<9).
     if (skel.vars.IEVersion < 9)
       $(':last-child').addClass('last-child');
   // Fix: Placeholder polyfill.
     $('form').placeholder();
   // Prioritize "important" elements on mobile.
     skel.on('+mobile -mobile', function() {
       $.prioritize(
         '.important\\28 mobile\\29',
         skel.breakpoint('mobile').active
       );
     });
   // Scrolly links.
     $('.scrolly').scrolly();
   // Nav.
     var $nav_a = $('#nav a');
     // Scrolly-fy links.
       $nav_a
         .scrolly()
         .on('click', function(e) {
           var t = $(this),
             href = t.attr('href');
           if (href[0] != '#')
             return;
             
           e.preventDefault();
           // Clear active and lock scrollzer until scrolling has stopped
             $nav_a
               .removeClass('active')
               .addClass('scrollzer-locked');
           // Set this link to active
             t.addClass('active');
         });
     // Initialize scrollzer.
       var ids = [];
       $nav_a.each(function() {
         var href = $(this).attr('href');
         if (href[0] != '#')
           return;
         ids.push(href.substring(1));
       });
       $.scrollzer(ids, { pad: 200, lastHack: true });
   // Header (narrower + mobile).
     // Toggle.
       $(
'
' +
           '<a href="#header" class="toggle"></a>' +
'
'
       )
         .appendTo($body);
     // Header.
       $('#header')
         .panel({
           delay: 300,
           hideOnClick: true,
           hideOnSwipe: true,
           resetScroll: true,
           resetForms: true,
           side: 'left',
           target: $body,
           visibleClass: 'header-visible'
         });
     // Fix: Remove transitions on WP<10 (poor/buggy performance).
       if (skel.vars.os == 'wp' && skel.vars.osVersion < 10)
         $('#headerToggle, #header, #main')
           .css('transition', 'none');
 });

})(jQuery);