Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * Init Template Components
- * only once after the initial
- * page load
- */
- function initComponentsOnce({
- scope = window.$document,
- container = window.$pageWrapper
- }) {
- const $sliderMenu = scope.find('.js-slider-menu');
- // Run cursor follower on non-touch devices
- if (window.kinsey.theme.cursorFollower.enabled && !window.Modernizr.touchevents && window.$cursor.length) {
- window.$html.addClass('cursorfollower');
- window.$cursor.artsCursor({
- target: {
- cursor: '[data-arts-cursor]',
- magnetic: '[data-arts-cursor-magnetic]',
- highlight: 'a:not(a[data-arts-cursor]):not(.social__item a):not(a.page-numbers):not(.js-arts-cursor-no-highlight), .js-arts-cursor-highlight, button:not(button[data-arts-cursor])',
- hideNative: '[data-arts-cursor-hide-native]',
- hideScaleMagnetic: '.slider__dot, .social__item, a.page-numbers',
- },
- elements: {
- follower: '.js-arts-cursor__follower',
- stroke: {
- inner: '.js-arts-cursor__stroke-inner',
- outer: '.js-arts-cursor__stroke-outer',
- },
- arrow: {
- up: '.js-arts-cursor__arrow-up',
- down: '.js-arts-cursor__arrow-down',
- left: '.js-arts-cursor__arrow-left',
- right: '.js-arts-cursor__arrow-right',
- },
- container: {
- label: '.js-arts-cursor__label',
- icon: '.js-arts-cursor__icon'
- }
- },
- effect: window.kinsey.theme.cursorFollower || {}
- });
- } else {
- window.$html.addClass('no-cursorfollower');
- }
- // Run AJAX navigation
- if (window.kinsey.theme.ajax.enabled && window.$barbaWrapper.length) {
- new PJAX({
- target: window.$barbaWrapper,
- });
- }
- // Run page header
- window.kinsey.theme.header = new Header({
- target: window.$pageHeader,
- scope
- });
- if ($sliderMenu.length) {
- $sliderMenu.each(function () {
- new SliderMenu({
- target: $(this),
- scope
- });
- });
- }
- // Reset (close) overlay menu when switching
- // from mobile to desktop screen size
- const mqHeader = window.matchMedia('(min-width: 992px');
- mqHeader.onchange = (e) => {
- if (e.matches) {
- window.kinsey.theme.header.closeMenu();
- }
- };
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement