From b0afdbb4f226a2b13ec83e2442ed90d617988a18 Mon Sep 17 00:00:00 2001 From: Antoine Ouvrard Date: Sat, 10 Apr 2021 21:24:38 +0200 Subject: reprise du code en prod --- assets/js/main.js | 105 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 105 insertions(+) create mode 100644 assets/js/main.js (limited to 'assets/js/main.js') diff --git a/assets/js/main.js b/assets/js/main.js new file mode 100644 index 0000000..7d9c058 --- /dev/null +++ b/assets/js/main.js @@ -0,0 +1,105 @@ +/* + Overflow by HTML5 UP + html5up.net | @ajlkn + Free for personal and commercial use under the CCA 3.0 license (html5up.net/license) +*/ + +(function($) { + + var $window = $(window), + $body = $('body'), + settings = { + + // Parallax background effect? + parallax: true, + + // Parallax factor (lower = more intense, higher = less intense). + parallaxFactor: 10 + + }; + + // Breakpoints. + breakpoints({ + wide: [ '1081px', '1680px' ], + normal: [ '841px', '1080px' ], + narrow: [ '737px', '840px' ], + mobile: [ null, '736px' ] + }); + + // Mobile? + if (browser.mobile) + $body.addClass('is-scroll'); + + // Play initial animations on page load. + $window.on('load', function() { + window.setTimeout(function() { + $body.removeClass('is-preload'); + }, 100); + }); + + // Scrolly. + $('.scrolly-middle').scrolly({ + speed: 1000, + anchor: 'middle' + }); + + $('.scrolly').scrolly({ + speed: 1000, + offset: function() { return (breakpoints.active('<=mobile') ? 70 : 190); } + }); + + // Parallax background. + + // Disable parallax on IE/Edge (smooth scrolling is jerky), and on mobile platforms (= better performance). + if (browser.name == 'ie' + || browser.name == 'edge' + || browser.mobile) + settings.parallax = false; + + if (settings.parallax) { + + var $dummy = $(), $bg; + + $window + .on('scroll.overflow_parallax', function() { + + // Adjust background position. + $bg.css('background-position', 'center ' + (-1 * (parseInt($window.scrollTop()) / settings.parallaxFactor)) + 'px'); + + }) + .on('resize.overflow_parallax', function() { + + // If we're in a situation where we need to temporarily disable parallax, do so. + if (breakpoints.active('<=narrow')) { + + $body.css('background-position', ''); + $bg = $dummy; + + } + + // Otherwise, continue as normal. + else + $bg = $body; + + // Trigger scroll handler. + $window.triggerHandler('scroll.overflow_parallax'); + + }) + .trigger('resize.overflow_parallax'); + + } + + // Poptrox. + $('.gallery').poptrox({ + useBodyOverflow: false, + usePopupEasyClose: false, + overlayColor: '#0a1919', + overlayOpacity: 0.75, + usePopupDefaultStyling: false, + usePopupCaption: true, + popupLoaderText: '', + windowMargin: 10, + usePopupNav: true + }); + +})(jQuery); \ No newline at end of file -- cgit v1.2.3