This repository has been archived on 2023-02-03. You can view files and clone it, but cannot push or open issues or pull requests.
autonomic.zone/src/assets/js/main.js

106 lines
2.2 KiB
JavaScript
Raw Normal View History

2017-09-22 09:46:39 +00:00
/*
Spectral by HTML5 UP
html5up.net | @ajlkn
Free for personal and commercial use under the CCA 3.0 license (html5up.net/license)
*/
(function($) {
skel
.breakpoints({
2017-09-22 12:44:13 +00:00
xlarge: '(max-width: 1680px)',
large: '(max-width: 1280px)',
medium: '(max-width: 980px)',
small: '(max-width: 736px)',
xsmall: '(max-width: 480px)'
2017-09-22 09:46:39 +00:00
});
$(function() {
2017-09-22 12:44:13 +00:00
var $window = $(window),
2017-09-22 09:46:39 +00:00
$body = $('body'),
$wrapper = $('#page-wrapper'),
$banner = $('#banner'),
$header = $('#header');
// Disable animations/transitions until the page has loaded.
2017-09-22 12:44:13 +00:00
$body.addClass('is-loading');
2017-09-22 09:46:39 +00:00
2017-09-22 12:44:13 +00:00
$window.on('load', function() {
window.setTimeout(function() {
$body.removeClass('is-loading');
}, 100);
});
2017-09-22 09:46:39 +00:00
// Mobile?
2017-09-22 12:44:13 +00:00
if (skel.vars.mobile)
$body.addClass('is-mobile');
else
skel
.on('-medium !medium', function() {
$body.removeClass('is-mobile');
})
.on('+medium', function() {
2017-09-22 09:46:39 +00:00
$body.addClass('is-mobile');
2017-09-22 12:44:13 +00:00
});
2017-09-22 09:46:39 +00:00
// Fix: Placeholder polyfill.
2017-09-22 12:44:13 +00:00
$('form').placeholder();
2017-09-22 09:46:39 +00:00
// Prioritize "important" elements on medium.
2017-09-22 12:44:13 +00:00
skel.on('+medium -medium', function() {
$.prioritize(
'.important\\28 medium\\29',
skel.breakpoint('medium').active
);
});
2017-09-22 09:46:39 +00:00
// Scrolly.
2017-09-22 12:44:13 +00:00
$('.scrolly')
.scrolly({
speed: 1500,
offset: $header.outerHeight()
});
2017-09-22 09:46:39 +00:00
// Menu.
2017-09-22 12:44:13 +00:00
$('#menu')
.append('<a href="#menu" class="close"></a>')
.appendTo($body)
.panel({
delay: 500,
hideOnClick: true,
hideOnSwipe: true,
resetScroll: true,
resetForms: true,
side: 'right',
target: $body,
visibleClass: 'is-menu-visible'
});
2017-09-22 09:46:39 +00:00
// Header.
2017-09-22 12:44:13 +00:00
if (skel.vars.IEVersion < 9)
$header.removeClass('alt');
2017-09-22 09:46:39 +00:00
2017-09-22 12:44:13 +00:00
if ($banner.length > 0 &&
$header.hasClass('alt')) {
$window.on('resize', function() {
$window.trigger('scroll');
});
$banner.scrollex({
bottom: $header.outerHeight() + 1,
terminate: function() {
$header.removeClass('alt');
},
enter: function() {
$header.addClass('alt');
},
leave: function() {
$header.removeClass('alt');
}
});
}
});
2017-09-22 12:08:30 +00:00
})(jQuery);