oDinZu c31a542e9c
Some checks failed
continuous-integration/drone/push Build is failing
ecommerce v1.6 GNU + bug fixes
2022-11-24 17:01:58 -05:00

72 lines
1.6 KiB
JavaScript

(function($) {
var $window = $(window),
$body = $('body'),
$header = $('#header');
// Breakpoints.
breakpoints({
xlarge: [ '1281px', '1680px' ],
large: [ '981px', '1280px' ],
medium: [ '737px', '980px' ],
small: [ '481px', '736px' ],
xsmall: [ null, '480px' ]
});
// Play initial animations on page load.
$window.on('load', function() {
window.setTimeout(function() {
$body.removeClass('is-preload');
}, 100);
});
// Scrolly.
$('.scrolly').scrolly({
offset: function() { return $header.outerHeight() }
});
// Menu.
$('#menu')
.append('<a href="#menu" class="close"></a>')
.appendTo($body)
.panel({
delay: 500,
hideOnClick: true,
hideOnSwipe: true,
resetScroll: true,
resetForms: true,
side: 'right'
});
// Header.
$window.on('resize', function() { $window.trigger('scroll'); });
$body.scrollex({
top: '25vh',
mode: 'top',
enter: function() { $header.addClass('alt'); },
leave: function() { $header.removeClass('alt'); }
});
})(jQuery);
// Get the button
let mybutton = document.getElementById("myBtn");
// When the user scrolls down 20px from the top of the document, show the button
window.onscroll = function() {scrollFunction()};
function scrollFunction() {
if (document.body.scrollTop > 700 || document.documentElement.scrollTop > 700) {
mybutton.style.display = "block";
} else {
mybutton.style.display = "none";
}
}
// When the user clicks on the button, scroll to the top of the document
function topFunction() {
document.body.scrollTop = 0;
document.documentElement.scrollTop = 0;
}