1/* 2 Hyperspace by HTML5 UP 3 html5up.net | @ajlkn 4 Free for personal and commercial use under the CCA 3.0 license (html5up.net/license) 5*/ 6 7(function($) { 8 9 var $window = $(window), 10 $body = $('body'), 11 $sidebar = $('#sidebar'); 12 13 // Breakpoints. 14 breakpoints({ 15 xlarge: [ '1281px', '1680px' ], 16 large: [ '981px', '1280px' ], 17 medium: [ '737px', '980px' ], 18 small: [ '481px', '736px' ], 19 xsmall: [ null, '480px' ] 20 }); 21 22 // Hack: Enable IE flexbox workarounds. 23 if (browser.name == 'ie') 24 $body.addClass('is-ie'); 25 26 // Play initial animations on page load. 27 $window.on('load', function() { 28 window.setTimeout(function() { 29 $body.removeClass('is-preload'); 30 }, 100); 31 }); 32 33 // Forms. 34 35 // Hack: Activate non-input submits. 36 $('form').on('click', '.submit', function(event) { 37 38 // Stop propagation, default. 39 event.stopPropagation(); 40 event.preventDefault(); 41 42 // Submit form. 43 $(this).parents('form').submit(); 44 45 }); 46 47 // Sidebar. 48 if ($sidebar.length > 0) { 49 50 var $sidebar_a = $sidebar.find('a'); 51 52 $sidebar_a 53 .addClass('scrolly') 54 .on('click', function() { 55 56 var $this = $(this); 57 58 // External link? Bail. 59 if ($this.attr('href').charAt(0) != '#') 60 return; 61 62 // Deactivate all links. 63 $sidebar_a.removeClass('active'); 64 65 // Activate link *and* lock it (so Scrollex doesn't try to activate other links as we're scrolling to this one's section). 66 $this 67 .addClass('active') 68 .addClass('active-locked'); 69 70 }) 71 .each(function() { 72 73 var $this = $(this), 74 id = $this.attr('href'), 75 $section = $(id); 76 77 // No section for this link? Bail. 78 if ($section.length < 1) 79 return; 80 81 // Scrollex. 82 $section.scrollex({ 83 mode: 'middle', 84 top: '-20vh', 85 bottom: '-20vh', 86 initialize: function() { 87 88 // Deactivate section. 89 $section.addClass('inactive'); 90 91 }, 92 enter: function() { 93 94 // Activate section. 95 $section.removeClass('inactive'); 96 97 // No locked links? Deactivate all links and activate this section's one. 98 if ($sidebar_a.filter('.active-locked').length == 0) { 99 100 $sidebar_a.removeClass('active'); 101 $this.addClass('active'); 102 103 } 104 105 // Otherwise, if this section's link is the one that's locked, unlock it. 106 else if ($this.hasClass('active-locked')) 107 $this.removeClass('active-locked'); 108 109 } 110 }); 111 112 }); 113 114 } 115 116 // Scrolly. 117 $('.scrolly').scrolly({ 118 speed: 1000, 119 offset: function() { 120 121 // If <=large, >small, and sidebar is present, use its height as the offset. 122 if (breakpoints.active('<=large') 123 && !breakpoints.active('<=small') 124 && $sidebar.length > 0) 125 return $sidebar.height(); 126 127 return 0; 128 129 } 130 }); 131 132 // Spotlights. 133 $('.spotlights > section') 134 .scrollex({ 135 mode: 'middle', 136 top: '-10vh', 137 bottom: '-10vh', 138 initialize: function() { 139 140 // Deactivate section. 141 $(this).addClass('inactive'); 142 143 }, 144 enter: function() { 145 146 // Activate section. 147 $(this).removeClass('inactive'); 148 149 } 150 }) 151 .each(function() { 152 153 var $this = $(this), 154 $image = $this.find('.image'), 155 $img = $image.find('img'), 156 x; 157 158 // Assign image. 159 $image.css('background-image', 'url(' + $img.attr('src') + ')'); 160 161 // Set background position. 162 if (x = $img.data('position')) 163 $image.css('background-position', x); 164 165 // Hide <img>. 166 $img.hide(); 167 168 }); 169 170 // Features. 171 $('.features') 172 .scrollex({ 173 mode: 'middle', 174 top: '-20vh', 175 bottom: '-20vh', 176 initialize: function() { 177 178 // Deactivate section. 179 $(this).addClass('inactive'); 180 181 }, 182 enter: function() { 183 184 // Activate section. 185 $(this).removeClass('inactive'); 186 187 } 188 }); 189 190})(jQuery);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.