1/* 2 Story 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 $wrapper = $('#wrapper'); 12 13 // Breakpoints. 14 breakpoints({ 15 xlarge: [ '1281px', '1680px' ], 16 large: [ '981px', '1280px' ], 17 medium: [ '737px', '980px' ], 18 small: [ '481px', '736px' ], 19 xsmall: [ '361px', '480px' ], 20 xxsmall: [ null, '360px' ] 21 }); 22 23 // Play initial animations on page load. 24 $window.on('load', function() { 25 window.setTimeout(function() { 26 $body.removeClass('is-preload'); 27 }, 100); 28 }); 29 30 // Browser fixes. 31 32 // IE: Flexbox min-height bug. 33 if (browser.name == 'ie') 34 (function() { 35 36 var flexboxFixTimeoutId; 37 38 $window.on('resize.flexbox-fix', function() { 39 40 var $x = $('.fullscreen'); 41 42 clearTimeout(flexboxFixTimeoutId); 43 44 flexboxFixTimeoutId = setTimeout(function() { 45 46 if ($x.prop('scrollHeight') > $window.height()) 47 $x.css('height', 'auto'); 48 else 49 $x.css('height', '100vh'); 50 51 }, 250); 52 53 }).triggerHandler('resize.flexbox-fix'); 54 55 })(); 56 57 // Object fit workaround. 58 if (!browser.canUse('object-fit')) 59 (function() { 60 61 $('.banner .image, .spotlight .image').each(function() { 62 63 var $this = $(this), 64 $img = $this.children('img'), 65 positionClass = $this.parent().attr('class').match(/image-position-([a-z]+)/); 66 67 // Set image. 68 $this 69 .css('background-image', 'url("' + $img.attr('src') + '")') 70 .css('background-repeat', 'no-repeat') 71 .css('background-size', 'cover'); 72 73 // Set position. 74 switch (positionClass.length > 1 ? positionClass[1] : '') { 75 76 case 'left': 77 $this.css('background-position', 'left'); 78 break; 79 80 case 'right': 81 $this.css('background-position', 'right'); 82 break; 83 84 default: 85 case 'center': 86 $this.css('background-position', 'center'); 87 break; 88 89 } 90 91 // Hide original. 92 $img.css('opacity', '0'); 93 94 }); 95 96 })(); 97 98 // Smooth scroll. 99 $('.smooth-scroll').scrolly(); 100 $('.smooth-scroll-middle').scrolly({ anchor: 'middle' }); 101 102 // Wrapper. 103 $wrapper.children() 104 .scrollex({ 105 top: '30vh', 106 bottom: '30vh', 107 initialize: function() { 108 $(this).addClass('is-inactive'); 109 }, 110 terminate: function() { 111 $(this).removeClass('is-inactive'); 112 }, 113 enter: function() { 114 $(this).removeClass('is-inactive'); 115 }, 116 leave: function() { 117 118 var $this = $(this); 119 120 if ($this.hasClass('onscroll-bidirectional')) 121 $this.addClass('is-inactive'); 122 123 } 124 }); 125 126 // Items. 127 $('.items') 128 .scrollex({ 129 top: '30vh', 130 bottom: '30vh', 131 delay: 50, 132 initialize: function() { 133 $(this).addClass('is-inactive'); 134 }, 135 terminate: function() { 136 $(this).removeClass('is-inactive'); 137 }, 138 enter: function() { 139 $(this).removeClass('is-inactive'); 140 }, 141 leave: function() { 142 143 var $this = $(this); 144 145 if ($this.hasClass('onscroll-bidirectional')) 146 $this.addClass('is-inactive'); 147 148 } 149 }) 150 .children() 151 .wrapInner('<div class="inner"></div>'); 152 153 // Gallery. 154 $('.gallery') 155 .wrapInner('<div class="inner"></div>') 156 .prepend(browser.mobile ? '' : '<div class="forward"></div><div class="backward"></div>') 157 .scrollex({ 158 top: '30vh', 159 bottom: '30vh', 160 delay: 50, 161 initialize: function() { 162 $(this).addClass('is-inactive'); 163 }, 164 terminate: function() { 165 $(this).removeClass('is-inactive'); 166 }, 167 enter: function() { 168 $(this).removeClass('is-inactive'); 169 }, 170 leave: function() { 171 172 var $this = $(this); 173 174 if ($this.hasClass('onscroll-bidirectional')) 175 $this.addClass('is-inactive'); 176 177 } 178 }) 179 .children('.inner') 180 //.css('overflow', 'hidden') 181 .css('overflow-y', browser.mobile ? 'visible' : 'hidden') 182 .css('overflow-x', browser.mobile ? 'scroll' : 'hidden') 183 .scrollLeft(0); 184 185 // Style #1. 186 // ... 187 188 // Style #2. 189 $('.gallery') 190 .on('wheel', '.inner', function(event) { 191 192 var $this = $(this), 193 delta = (event.originalEvent.deltaX * 10); 194 195 // Cap delta. 196 if (delta > 0) 197 delta = Math.min(25, delta); 198 else if (delta < 0) 199 delta = Math.max(-25, delta); 200 201 // Scroll. 202 $this.scrollLeft( $this.scrollLeft() + delta ); 203 204 }) 205 .on('mouseenter', '.forward, .backward', function(event) { 206 207 var $this = $(this), 208 $inner = $this.siblings('.inner'), 209 direction = ($this.hasClass('forward') ? 1 : -1); 210 211 // Clear move interval. 212 clearInterval(this._gallery_moveIntervalId); 213 214 // Start interval. 215 this._gallery_moveIntervalId = setInterval(function() { 216 $inner.scrollLeft( $inner.scrollLeft() + (5 * direction) ); 217 }, 10); 218 219 }) 220 .on('mouseleave', '.forward, .backward', function(event) { 221 222 // Clear move interval. 223 clearInterval(this._gallery_moveIntervalId); 224 225 }); 226 227 // Lightbox. 228 $('.gallery.lightbox') 229 .on('click', 'a', function(event) { 230 231 var $a = $(this), 232 $gallery = $a.parents('.gallery'), 233 $modal = $gallery.children('.modal'), 234 $modalImg = $modal.find('img'), 235 href = $a.attr('href'); 236 237 // Not an image? Bail. 238 if (!href.match(/\.(jpg|gif|png|mp4)$/)) 239 return; 240 241 // Prevent default. 242 event.preventDefault(); 243 event.stopPropagation(); 244 245 // Locked? Bail. 246 if ($modal[0]._locked) 247 return; 248 249 // Lock. 250 $modal[0]._locked = true; 251 252 // Set src. 253 $modalImg.attr('src', href); 254 255 // Set visible. 256 $modal.addClass('visible'); 257 258 // Focus. 259 $modal.focus(); 260 261 // Delay. 262 setTimeout(function() { 263 264 // Unlock. 265 $modal[0]._locked = false; 266 267 }, 600); 268 269 }) 270 .on('click', '.modal', function(event) { 271 272 var $modal = $(this), 273 $modalImg = $modal.find('img'); 274 275 // Locked? Bail. 276 if ($modal[0]._locked) 277 return; 278 279 // Already hidden? Bail. 280 if (!$modal.hasClass('visible')) 281 return; 282 283 // Lock. 284 $modal[0]._locked = true; 285 286 // Clear visible, loaded. 287 $modal 288 .removeClass('loaded') 289 290 // Delay. 291 setTimeout(function() { 292 293 $modal 294 .removeClass('visible') 295 296 setTimeout(function() { 297 298 // Clear src. 299 $modalImg.attr('src', ''); 300 301 // Unlock. 302 $modal[0]._locked = false; 303 304 // Focus. 305 $body.focus(); 306 307 }, 475); 308 309 }, 125); 310 311 }) 312 .on('keypress', '.modal', function(event) { 313 314 var $modal = $(this); 315 316 // Escape? Hide modal. 317 if (event.keyCode == 27) 318 $modal.trigger('click'); 319 320 }) 321 .prepend('<div class="modal" tabIndex="-1"><div class="inner"><img src="" /></div></div>') 322 .find('img') 323 .on('load', function(event) { 324 325 var $modalImg = $(this), 326 $modal = $modalImg.parents('.modal'); 327 328 setTimeout(function() { 329 330 // No longer visible? Bail. 331 if (!$modal.hasClass('visible')) 332 return; 333 334 // Set loaded. 335 $modal.addClass('loaded'); 336 337 }, 275); 338 339 });
340 341})(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.