first commit
This commit is contained in:
0
assets/js/SplitText.html
Normal file
0
assets/js/SplitText.html
Normal file
120
assets/js/appear.js
Normal file
120
assets/js/appear.js
Normal file
@@ -0,0 +1,120 @@
|
||||
(function ($) {
|
||||
var selectors = [];
|
||||
|
||||
var checkBinded = false;
|
||||
var checkLock = false;
|
||||
var defaults = {
|
||||
interval: 250,
|
||||
force_process: false
|
||||
};
|
||||
var $window = $(window);
|
||||
|
||||
var $priorAppeared = [];
|
||||
|
||||
function isAppeared() {
|
||||
return $(this).is(':appeared');
|
||||
}
|
||||
|
||||
function isNotTriggered() {
|
||||
return !$(this).data('_appear_triggered');
|
||||
}
|
||||
|
||||
function process() {
|
||||
checkLock = false;
|
||||
|
||||
for (var index = 0, selectorsLength = selectors.length; index < selectorsLength; index++) {
|
||||
var $appeared = $(selectors[index]).filter(isAppeared);
|
||||
|
||||
$appeared
|
||||
.filter(isNotTriggered)
|
||||
.data('_appear_triggered', true)
|
||||
.trigger('appear', [$appeared]);
|
||||
|
||||
if ($priorAppeared[index]) {
|
||||
var $disappeared = $priorAppeared[index].not($appeared);
|
||||
$disappeared
|
||||
.data('_appear_triggered', false)
|
||||
.trigger('disappear', [$disappeared]);
|
||||
}
|
||||
$priorAppeared[index] = $appeared;
|
||||
}
|
||||
}
|
||||
|
||||
function addSelector(selector) {
|
||||
selectors.push(selector);
|
||||
$priorAppeared.push();
|
||||
}
|
||||
|
||||
// ":appeared" custom filter
|
||||
$.expr.pseudos.appeared = $.expr.createPseudo(function (_arg) {
|
||||
return function (element) {
|
||||
var $element = $(element);
|
||||
|
||||
if (!$element.is(':visible')) {
|
||||
return false;
|
||||
}
|
||||
|
||||
var windowLeft = $window.scrollLeft();
|
||||
var windowTop = $window.scrollTop();
|
||||
var offset = $element.offset();
|
||||
var left = offset.left;
|
||||
var top = offset.top;
|
||||
|
||||
if (top + $element.height() >= windowTop &&
|
||||
top - ($element.data('appear-top-offset') || 0) <= windowTop + $window.height() &&
|
||||
left + $element.width() >= windowLeft &&
|
||||
left - ($element.data('appear-left-offset') || 0) <= windowLeft + $window.width()) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
};
|
||||
});
|
||||
|
||||
$.fn.extend({
|
||||
// watching for element's appearance in browser viewport
|
||||
appear: function (selector, options) {
|
||||
$.appear(this, options);
|
||||
return this;
|
||||
}
|
||||
});
|
||||
|
||||
$.extend({
|
||||
appear: function (selector, options) {
|
||||
var opts = $.extend({}, defaults, options || {});
|
||||
|
||||
if (!checkBinded) {
|
||||
var onCheck = function () {
|
||||
if (checkLock) {
|
||||
return;
|
||||
}
|
||||
checkLock = true;
|
||||
|
||||
setTimeout(process, opts.interval);
|
||||
};
|
||||
|
||||
$(window).scroll(onCheck).resize(onCheck);
|
||||
checkBinded = true;
|
||||
}
|
||||
|
||||
if (opts.force_process) {
|
||||
setTimeout(process, opts.interval);
|
||||
}
|
||||
|
||||
addSelector(selector);
|
||||
},
|
||||
// force elements's appearance check
|
||||
force_appear: function () {
|
||||
if (checkBinded) {
|
||||
process();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
});
|
||||
}(function () {
|
||||
if (typeof module !== 'undefined') {
|
||||
// Node
|
||||
return require('jquery');
|
||||
}
|
||||
return jQuery;
|
||||
}()));
|
||||
6
assets/js/bootstrap.bundle.min.js
vendored
Normal file
6
assets/js/bootstrap.bundle.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
168
assets/js/easing.min.js
vendored
Normal file
168
assets/js/easing.min.js
vendored
Normal file
@@ -0,0 +1,168 @@
|
||||
/*
|
||||
* jQuery Easing v1.4.1 - http://gsgd.co.uk/sandbox/jquery/easing/
|
||||
* Open source under the BSD License.
|
||||
* Copyright © 2008 George McGinley Smith
|
||||
* All rights reserved.
|
||||
* https://raw.github.com/gdsmith/jquery.easing/master/LICENSE
|
||||
*/
|
||||
|
||||
/* globals jQuery, define, module, require */
|
||||
(function (factory) {
|
||||
if (typeof define === "function" && define.amd) {
|
||||
define(['jquery'], function ($) {
|
||||
return factory($);
|
||||
});
|
||||
} else if (typeof module === "object" && typeof module.exports === "object") {
|
||||
module.exports = factory(require('jquery'));
|
||||
} else {
|
||||
factory(jQuery);
|
||||
}
|
||||
})(function($){
|
||||
|
||||
// Preserve the original jQuery "swing" easing as "jswing"
|
||||
if (typeof $.easing !== 'undefined') {
|
||||
$.easing['jswing'] = $.easing['swing'];
|
||||
}
|
||||
|
||||
var pow = Math.pow,
|
||||
sqrt = Math.sqrt,
|
||||
sin = Math.sin,
|
||||
cos = Math.cos,
|
||||
PI = Math.PI,
|
||||
c1 = 1.70158,
|
||||
c2 = c1 * 1.525,
|
||||
c3 = c1 + 1,
|
||||
c4 = ( 2 * PI ) / 3,
|
||||
c5 = ( 2 * PI ) / 4.5;
|
||||
|
||||
// x is the fraction of animation progress, in the range 0..1
|
||||
function bounceOut(x) {
|
||||
var n1 = 7.5625,
|
||||
d1 = 2.75;
|
||||
if ( x < 1/d1 ) {
|
||||
return n1*x*x;
|
||||
} else if ( x < 2/d1 ) {
|
||||
return n1*(x-=(1.5/d1))*x + .75;
|
||||
} else if ( x < 2.5/d1 ) {
|
||||
return n1*(x-=(2.25/d1))*x + .9375;
|
||||
} else {
|
||||
return n1*(x-=(2.625/d1))*x + .984375;
|
||||
}
|
||||
}
|
||||
|
||||
$.extend( $.easing, {
|
||||
def: 'easeOutQuad',
|
||||
swing: function (x) {
|
||||
return $.easing[$.easing.def](x);
|
||||
},
|
||||
easeInQuad: function (x) {
|
||||
return x * x;
|
||||
},
|
||||
easeOutQuad: function (x) {
|
||||
return 1 - ( 1 - x ) * ( 1 - x );
|
||||
},
|
||||
easeInOutQuad: function (x) {
|
||||
return x < 0.5 ?
|
||||
2 * x * x :
|
||||
1 - pow( -2 * x + 2, 2 ) / 2;
|
||||
},
|
||||
easeInCubic: function (x) {
|
||||
return x * x * x;
|
||||
},
|
||||
easeOutCubic: function (x) {
|
||||
return 1 - pow( 1 - x, 3 );
|
||||
},
|
||||
easeInOutCubic: function (x) {
|
||||
return x < 0.5 ?
|
||||
4 * x * x * x :
|
||||
1 - pow( -2 * x + 2, 3 ) / 2;
|
||||
},
|
||||
easeInQuart: function (x) {
|
||||
return x * x * x * x;
|
||||
},
|
||||
easeOutQuart: function (x) {
|
||||
return 1 - pow( 1 - x, 4 );
|
||||
},
|
||||
easeInOutQuart: function (x) {
|
||||
return x < 0.5 ?
|
||||
8 * x * x * x * x :
|
||||
1 - pow( -2 * x + 2, 4 ) / 2;
|
||||
},
|
||||
easeInQuint: function (x) {
|
||||
return x * x * x * x * x;
|
||||
},
|
||||
easeOutQuint: function (x) {
|
||||
return 1 - pow( 1 - x, 5 );
|
||||
},
|
||||
easeInOutQuint: function (x) {
|
||||
return x < 0.5 ?
|
||||
16 * x * x * x * x * x :
|
||||
1 - pow( -2 * x + 2, 5 ) / 2;
|
||||
},
|
||||
easeInSine: function (x) {
|
||||
return 1 - cos( x * PI/2 );
|
||||
},
|
||||
easeOutSine: function (x) {
|
||||
return sin( x * PI/2 );
|
||||
},
|
||||
easeInOutSine: function (x) {
|
||||
return -( cos( PI * x ) - 1 ) / 2;
|
||||
},
|
||||
easeInExpo: function (x) {
|
||||
return x === 0 ? 0 : pow( 2, 10 * x - 10 );
|
||||
},
|
||||
easeOutExpo: function (x) {
|
||||
return x === 1 ? 1 : 1 - pow( 2, -10 * x );
|
||||
},
|
||||
easeInOutExpo: function (x) {
|
||||
return x === 0 ? 0 : x === 1 ? 1 : x < 0.5 ?
|
||||
pow( 2, 20 * x - 10 ) / 2 :
|
||||
( 2 - pow( 2, -20 * x + 10 ) ) / 2;
|
||||
},
|
||||
easeInCirc: function (x) {
|
||||
return 1 - sqrt( 1 - pow( x, 2 ) );
|
||||
},
|
||||
easeOutCirc: function (x) {
|
||||
return sqrt( 1 - pow( x - 1, 2 ) );
|
||||
},
|
||||
easeInOutCirc: function (x) {
|
||||
return x < 0.5 ?
|
||||
( 1 - sqrt( 1 - pow( 2 * x, 2 ) ) ) / 2 :
|
||||
( sqrt( 1 - pow( -2 * x + 2, 2 ) ) + 1 ) / 2;
|
||||
},
|
||||
easeInElastic: function (x) {
|
||||
return x === 0 ? 0 : x === 1 ? 1 :
|
||||
-pow( 2, 10 * x - 10 ) * sin( ( x * 10 - 10.75 ) * c4 );
|
||||
},
|
||||
easeOutElastic: function (x) {
|
||||
return x === 0 ? 0 : x === 1 ? 1 :
|
||||
pow( 2, -10 * x ) * sin( ( x * 10 - 0.75 ) * c4 ) + 1;
|
||||
},
|
||||
easeInOutElastic: function (x) {
|
||||
return x === 0 ? 0 : x === 1 ? 1 : x < 0.5 ?
|
||||
-( pow( 2, 20 * x - 10 ) * sin( ( 20 * x - 11.125 ) * c5 )) / 2 :
|
||||
pow( 2, -20 * x + 10 ) * sin( ( 20 * x - 11.125 ) * c5 ) / 2 + 1;
|
||||
},
|
||||
easeInBack: function (x) {
|
||||
return c3 * x * x * x - c1 * x * x;
|
||||
},
|
||||
easeOutBack: function (x) {
|
||||
return 1 + c3 * pow( x - 1, 3 ) + c1 * pow( x - 1, 2 );
|
||||
},
|
||||
easeInOutBack: function (x) {
|
||||
return x < 0.5 ?
|
||||
( pow( 2 * x, 2 ) * ( ( c2 + 1 ) * 2 * x - c2 ) ) / 2 :
|
||||
( pow( 2 * x - 2, 2 ) *( ( c2 + 1 ) * ( x * 2 - 2 ) + c2 ) + 2 ) / 2;
|
||||
},
|
||||
easeInBounce: function (x) {
|
||||
return 1 - bounceOut( 1 - x );
|
||||
},
|
||||
easeOutBounce: bounceOut,
|
||||
easeInOutBounce: function (x) {
|
||||
return x < 0.5 ?
|
||||
( 1 - bounceOut( 1 - 2 * x ) ) / 2 :
|
||||
( 1 + bounceOut( 2 * x - 1 ) ) / 2;
|
||||
}
|
||||
});
|
||||
return $;
|
||||
});
|
||||
149
assets/js/imageRevealHover.js
Normal file
149
assets/js/imageRevealHover.js
Normal file
@@ -0,0 +1,149 @@
|
||||
/**
|
||||
* demo.js
|
||||
* http://www.codrops.com
|
||||
*
|
||||
* Licensed under the MIT license.
|
||||
* http://www.opensource.org/licenses/mit-license.php
|
||||
*
|
||||
* Copyright 2018, Codrops
|
||||
* http://www.codrops.com
|
||||
*/
|
||||
{
|
||||
const mapNumber = (X,A,B,C,D) => (X-A)*(D-C)/(B-A)+C;
|
||||
// from http://www.quirksmode.org/js/events_properties.html#position
|
||||
const getMousePos = (e) => {
|
||||
let posx = 0;
|
||||
let posy = 0;
|
||||
if (!e) e = window.event;
|
||||
if (e.pageX || e.pageY) {
|
||||
posx = e.pageX;
|
||||
posy = e.pageY;
|
||||
}
|
||||
else if (e.clientX || e.clientY) {
|
||||
posx = e.clientX + document.body.scrollLeft + document.documentElement.scrollLeft;
|
||||
posy = e.clientY + document.body.scrollTop + document.documentElement.scrollTop;
|
||||
}
|
||||
return { x : posx, y : posy }
|
||||
}
|
||||
// Generate a random float.
|
||||
const getRandomFloat = (min, max) => (Math.random() * (max - min) + min).toFixed(2);
|
||||
|
||||
/**
|
||||
* One class per effect.
|
||||
* Lots of code is repeated, so that single effects can be easily used.
|
||||
*/
|
||||
|
||||
// Effect 1
|
||||
class HoverImgFx1 {
|
||||
constructor(el) {
|
||||
this.DOM = {el: el};
|
||||
this.DOM.reveal = document.createElement('div');
|
||||
this.DOM.reveal.className = 'xb-img-reveal-wrapper';
|
||||
this.DOM.reveal.innerHTML =
|
||||
`<div class="xb-img-reveal-wrapper__inner">
|
||||
<div class="xb-img-reveal-wrapper__img">
|
||||
<div class="xb-hover-wrapper">
|
||||
<img src="${this.DOM.el.dataset.img ? this.DOM.el.dataset.img: ''}" alt="">
|
||||
</div>
|
||||
</div>
|
||||
</div>`;
|
||||
this.DOM.el.appendChild(this.DOM.reveal);
|
||||
this.DOM.revealInner = this.DOM.reveal.querySelector('.xb-img-reveal-wrapper__inner');
|
||||
this.DOM.revealInner.style.overflow = 'hidden';
|
||||
this.DOM.revealImg = this.DOM.revealInner.querySelector('.xb-img-reveal-wrapper__img');
|
||||
|
||||
this.initEvents();
|
||||
}
|
||||
initEvents() {
|
||||
this.positionElement = (ev) => {
|
||||
const mousePos = getMousePos(ev);
|
||||
const docScrolls = {
|
||||
left : document.body.scrollLeft + document.documentElement.scrollLeft,
|
||||
top : document.body.scrollTop + document.documentElement.scrollTop
|
||||
};
|
||||
this.DOM.reveal.style.top = `${mousePos.y+20-docScrolls.top}px`;
|
||||
this.DOM.reveal.style.left = `${mousePos.x+20-docScrolls.left}px`;
|
||||
};
|
||||
this.mouseenterFn = (ev) => {
|
||||
this.positionElement(ev);
|
||||
this.showImage();
|
||||
};
|
||||
this.mousemoveFn = ev => requestAnimationFrame(() => {
|
||||
this.positionElement(ev);
|
||||
});
|
||||
this.mouseleaveFn = () => {
|
||||
this.hideImage();
|
||||
};
|
||||
|
||||
this.DOM.el.addEventListener('mouseenter', this.mouseenterFn);
|
||||
this.DOM.el.addEventListener('mousemove', this.mousemoveFn);
|
||||
this.DOM.el.addEventListener('mouseleave', this.mouseleaveFn);
|
||||
}
|
||||
showImage() {
|
||||
TweenMax.killTweensOf(this.DOM.revealInner);
|
||||
TweenMax.killTweensOf(this.DOM.revealImg);
|
||||
|
||||
this.tl = new TimelineMax({
|
||||
onStart: () => {
|
||||
this.DOM.reveal.style.opacity = 1;
|
||||
TweenMax.set(this.DOM.el, {zIndex: 9});
|
||||
}
|
||||
})
|
||||
.add('begin')
|
||||
.add(new TweenMax(this.DOM.revealInner, 0.2, {
|
||||
ease: Sine.easeOut,
|
||||
startAt: {x: '-100%'},
|
||||
x: '0%'
|
||||
}), 'begin')
|
||||
.add(new TweenMax(this.DOM.revealImg, 0.2, {
|
||||
ease: Sine.easeOut,
|
||||
startAt: {x: '100%'},
|
||||
x: '0%'
|
||||
}), 'begin');
|
||||
}
|
||||
hideImage() {
|
||||
TweenMax.killTweensOf(this.DOM.revealInner);
|
||||
TweenMax.killTweensOf(this.DOM.revealImg);
|
||||
|
||||
this.tl = new TimelineMax({
|
||||
onStart: () => {
|
||||
TweenMax.set(this.DOM.el, {zIndex: 8});
|
||||
},
|
||||
onComplete: () => {
|
||||
TweenMax.set(this.DOM.el, {zIndex: ''});
|
||||
TweenMax.set(this.DOM.reveal, {opacity: 0});
|
||||
}
|
||||
})
|
||||
.add('begin')
|
||||
.add(new TweenMax(this.DOM.revealInner, 0.2, {
|
||||
ease: Sine.easeOut,
|
||||
x: '100%'
|
||||
}), 'begin')
|
||||
|
||||
.add(new TweenMax(this.DOM.revealImg, 0.2, {
|
||||
ease: Sine.easeOut,
|
||||
x: '-100%'
|
||||
}), 'begin');
|
||||
}
|
||||
}
|
||||
|
||||
[...document.querySelectorAll('[data-fx="pt1"] > .xb-img-reveal-item, .xb-img-reveal-item[data-fx="pt1"]')].forEach(link => new HoverPTCard1(link));
|
||||
[...document.querySelectorAll('[data-fx="1"] > .xb-img-reveal-item, .xb-img-reveal-item[data-fx="1"]')].forEach(link => new HoverImgFx1(link));
|
||||
|
||||
const contentel = document.querySelector('.content');
|
||||
[...document.querySelectorAll('.block__title, .block__link, .content__text-link')].forEach((el) => {
|
||||
const imgsArr = el.dataset.img.split(',');
|
||||
const imgsSubtitle = el.dataset.subtitle.split(',');
|
||||
const imgsTitle = el.dataset.title.split(',');
|
||||
const imgsDate = el.dataset.metadate.split(',');
|
||||
const imgsAuthor = el.dataset.metaauthor.split(',');
|
||||
for (let i = 0, len = imgsArr.length; i <= len-1; ++i ) {
|
||||
const imgel = document.createElement('img');
|
||||
imgel.style.visibility = 'hidden';
|
||||
imgel.style.width = 0;
|
||||
imgel.src = imgsArr[i];
|
||||
imgel.className = 'preload';
|
||||
contentel.appendChild(imgel);
|
||||
}
|
||||
});
|
||||
}
|
||||
7
assets/js/imagesloaded.pkgd.min.js
vendored
Normal file
7
assets/js/imagesloaded.pkgd.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
12
assets/js/isotope.pkgd.min.js
vendored
Normal file
12
assets/js/isotope.pkgd.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
4
assets/js/jquery-3.7.1.min.js
vendored
Normal file
4
assets/js/jquery-3.7.1.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
4
assets/js/jquery.magnific-popup.min.js
vendored
Normal file
4
assets/js/jquery.magnific-popup.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
1
assets/js/jquery.marquee.min.js
vendored
Normal file
1
assets/js/jquery.marquee.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
4
assets/js/jquery.nice-select.min.js
vendored
Normal file
4
assets/js/jquery.nice-select.min.js
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
/* jQuery Nice Select - v1.0
|
||||
https://github.com/hernansartorio/jquery-nice-select
|
||||
Made by Hernán Sartorio */
|
||||
!function(e){e.fn.niceSelect=function(t){function s(t){t.after(e("<div></div>").addClass("nice-select").addClass(t.attr("class")||"").addClass(t.attr("disabled")?"disabled":"").attr("tabindex",t.attr("disabled")?null:"0").html('<span class="current"></span><ul class="list"></ul>'));var s=t.next(),n=t.find("option"),i=t.find("option:selected");s.find(".current").html(i.data("display")||i.text()),n.each(function(t){var n=e(this),i=n.data("display");s.find("ul").append(e("<li></li>").attr("data-value",n.val()).attr("data-display",i||null).addClass("option"+(n.is(":selected")?" selected":"")+(n.is(":disabled")?" disabled":"")).html(n.text()))})}if("string"==typeof t)return"update"==t?this.each(function(){var t=e(this),n=e(this).next(".nice-select"),i=n.hasClass("open");n.length&&(n.remove(),s(t),i&&t.next().trigger("click"))}):"destroy"==t?(this.each(function(){var t=e(this),s=e(this).next(".nice-select");s.length&&(s.remove(),t.css("display",""))}),0==e(".nice-select").length&&e(document).off(".nice_select")):console.log('Method "'+t+'" does not exist.'),this;this.hide(),this.each(function(){var t=e(this);t.next().hasClass("nice-select")||s(t)}),e(document).off(".nice_select"),e(document).on("click.nice_select",".nice-select",function(t){var s=e(this);e(".nice-select").not(s).removeClass("open"),s.toggleClass("open"),s.hasClass("open")?(s.find(".option"),s.find(".focus").removeClass("focus"),s.find(".selected").addClass("focus")):s.focus()}),e(document).on("click.nice_select",function(t){0===e(t.target).closest(".nice-select").length&&e(".nice-select").removeClass("open").find(".option")}),e(document).on("click.nice_select",".nice-select .option:not(.disabled)",function(t){var s=e(this),n=s.closest(".nice-select");n.find(".selected").removeClass("selected"),s.addClass("selected");var i=s.data("display")||s.text();n.find(".current").text(i),n.prev("select").val(s.data("value")).trigger("change")}),e(document).on("keydown.nice_select",".nice-select",function(t){var s=e(this),n=e(s.find(".focus")||s.find(".list .option.selected"));if(32==t.keyCode||13==t.keyCode)return s.hasClass("open")?n.trigger("click"):s.trigger("click"),!1;if(40==t.keyCode){if(s.hasClass("open")){var i=n.nextAll(".option:not(.disabled)").first();i.length>0&&(s.find(".focus").removeClass("focus"),i.addClass("focus"))}else s.trigger("click");return!1}if(38==t.keyCode){if(s.hasClass("open")){var l=n.prevAll(".option:not(.disabled)").first();l.length>0&&(s.find(".focus").removeClass("focus"),l.addClass("focus"))}else s.trigger("click");return!1}if(27==t.keyCode)s.hasClass("open")&&s.trigger("click");else if(9==t.keyCode&&s.hasClass("open"))return!1});var n=document.createElement("a").style;return n.cssText="pointer-events:auto","auto"!==n.pointerEvents&&e("html").addClass("no-csspointerevents"),this}}(jQuery);
|
||||
778
assets/js/lenis.js
Normal file
778
assets/js/lenis.js
Normal file
@@ -0,0 +1,778 @@
|
||||
(function (global, factory) {
|
||||
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
|
||||
typeof define === 'function' && define.amd ? define(factory) :
|
||||
(global = global || self, global.Lenis = factory());
|
||||
})(this, (function () {
|
||||
function _defineProperties(target, props) {
|
||||
for (var i = 0; i < props.length; i++) {
|
||||
var descriptor = props[i];
|
||||
descriptor.enumerable = descriptor.enumerable || false;
|
||||
descriptor.configurable = true;
|
||||
if ("value" in descriptor) descriptor.writable = true;
|
||||
Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor);
|
||||
}
|
||||
}
|
||||
function _createClass(Constructor, protoProps, staticProps) {
|
||||
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
|
||||
if (staticProps) _defineProperties(Constructor, staticProps);
|
||||
Object.defineProperty(Constructor, "prototype", {
|
||||
writable: false
|
||||
});
|
||||
return Constructor;
|
||||
}
|
||||
function _extends() {
|
||||
_extends = Object.assign ? Object.assign.bind() : function (target) {
|
||||
for (var i = 1; i < arguments.length; i++) {
|
||||
var source = arguments[i];
|
||||
for (var key in source) {
|
||||
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
||||
target[key] = source[key];
|
||||
}
|
||||
}
|
||||
}
|
||||
return target;
|
||||
};
|
||||
return _extends.apply(this, arguments);
|
||||
}
|
||||
function _toPrimitive(input, hint) {
|
||||
if (typeof input !== "object" || input === null) return input;
|
||||
var prim = input[Symbol.toPrimitive];
|
||||
if (prim !== undefined) {
|
||||
var res = prim.call(input, hint || "default");
|
||||
if (typeof res !== "object") return res;
|
||||
throw new TypeError("@@toPrimitive must return a primitive value.");
|
||||
}
|
||||
return (hint === "string" ? String : Number)(input);
|
||||
}
|
||||
function _toPropertyKey(arg) {
|
||||
var key = _toPrimitive(arg, "string");
|
||||
return typeof key === "symbol" ? key : String(key);
|
||||
}
|
||||
|
||||
var version = "1.0.16";
|
||||
|
||||
// Clamp a value between a minimum and maximum value
|
||||
function clamp(min, input, max) {
|
||||
return Math.max(min, Math.min(input, max));
|
||||
}
|
||||
|
||||
// Linearly interpolate between two values using an amount (0 <= t <= 1)
|
||||
function lerp(x, y, t) {
|
||||
return (1 - t) * x + t * y;
|
||||
}
|
||||
|
||||
// http://www.rorydriscoll.com/2016/03/07/frame-rate-independent-damping-using-lerp/
|
||||
function damp(x, y, lambda, dt) {
|
||||
return lerp(x, y, 1 - Math.exp(-lambda * dt));
|
||||
}
|
||||
|
||||
// Calculate the modulo of the dividend and divisor while keeping the result within the same sign as the divisor
|
||||
// https://anguscroll.com/just/just-modulo
|
||||
function modulo(n, d) {
|
||||
return (n % d + d) % d;
|
||||
}
|
||||
|
||||
// Animate class to handle value animations with lerping or easing
|
||||
var Animate = /*#__PURE__*/function () {
|
||||
function Animate() {}
|
||||
var _proto = Animate.prototype;
|
||||
// Advance the animation by the given delta time
|
||||
_proto.advance = function advance(deltaTime) {
|
||||
var _this$onUpdate;
|
||||
if (!this.isRunning) return;
|
||||
var completed = false;
|
||||
if (this.lerp) {
|
||||
this.value = damp(this.value, this.to, this.lerp * 60, deltaTime);
|
||||
if (Math.round(this.value) === this.to) {
|
||||
this.value = this.to;
|
||||
completed = true;
|
||||
}
|
||||
} else {
|
||||
this.currentTime += deltaTime;
|
||||
var linearProgress = clamp(0, this.currentTime / this.duration, 1);
|
||||
completed = linearProgress >= 1;
|
||||
var easedProgress = completed ? 1 : this.easing(linearProgress);
|
||||
this.value = this.from + (this.to - this.from) * easedProgress;
|
||||
}
|
||||
|
||||
// Call the onUpdate callback with the current value and completed status
|
||||
(_this$onUpdate = this.onUpdate) == null ? void 0 : _this$onUpdate.call(this, this.value, {
|
||||
completed: completed
|
||||
});
|
||||
if (completed) {
|
||||
this.stop();
|
||||
}
|
||||
}
|
||||
|
||||
// Stop the animation
|
||||
;
|
||||
_proto.stop = function stop() {
|
||||
this.isRunning = false;
|
||||
}
|
||||
|
||||
// Set up the animation from a starting value to an ending value
|
||||
// with optional parameters for lerping, duration, easing, and onUpdate callback
|
||||
;
|
||||
_proto.fromTo = function fromTo(from, to, _ref) {
|
||||
var _ref$lerp = _ref.lerp,
|
||||
lerp = _ref$lerp === void 0 ? 0.1 : _ref$lerp,
|
||||
_ref$duration = _ref.duration,
|
||||
duration = _ref$duration === void 0 ? 1 : _ref$duration,
|
||||
_ref$easing = _ref.easing,
|
||||
easing = _ref$easing === void 0 ? function (t) {
|
||||
return t;
|
||||
} : _ref$easing,
|
||||
onUpdate = _ref.onUpdate;
|
||||
this.from = this.value = from;
|
||||
this.to = to;
|
||||
this.lerp = lerp;
|
||||
this.duration = duration;
|
||||
this.easing = easing;
|
||||
this.currentTime = 0;
|
||||
this.isRunning = true;
|
||||
this.onUpdate = onUpdate;
|
||||
};
|
||||
return Animate;
|
||||
}();
|
||||
|
||||
function debounce(callback, delay) {
|
||||
var timer;
|
||||
return function () {
|
||||
var args = arguments;
|
||||
var context = this;
|
||||
clearTimeout(timer);
|
||||
timer = setTimeout(function () {
|
||||
callback.apply(context, args);
|
||||
}, delay);
|
||||
};
|
||||
}
|
||||
|
||||
var Dimensions = /*#__PURE__*/function () {
|
||||
function Dimensions(_temp) {
|
||||
var _this = this;
|
||||
var _ref = _temp === void 0 ? {} : _temp,
|
||||
wrapper = _ref.wrapper,
|
||||
content = _ref.content,
|
||||
_ref$autoResize = _ref.autoResize,
|
||||
autoResize = _ref$autoResize === void 0 ? true : _ref$autoResize;
|
||||
this.resize = function () {
|
||||
_this.onWrapperResize();
|
||||
_this.onContentResize();
|
||||
};
|
||||
this.onWrapperResize = function () {
|
||||
if (_this.wrapper === window) {
|
||||
_this.width = window.innerWidth;
|
||||
_this.height = window.innerHeight;
|
||||
} else {
|
||||
_this.width = _this.wrapper.clientWidth;
|
||||
_this.height = _this.wrapper.clientHeight;
|
||||
}
|
||||
};
|
||||
this.onContentResize = function () {
|
||||
_this.scrollHeight = _this.content.scrollHeight;
|
||||
_this.scrollWidth = _this.content.scrollWidth;
|
||||
};
|
||||
this.wrapper = wrapper;
|
||||
this.content = content;
|
||||
if (autoResize) {
|
||||
var resize = debounce(this.resize, 250);
|
||||
if (this.wrapper !== window) {
|
||||
this.wrapperResizeObserver = new ResizeObserver(resize);
|
||||
this.wrapperResizeObserver.observe(this.wrapper);
|
||||
}
|
||||
this.contentResizeObserver = new ResizeObserver(resize);
|
||||
this.contentResizeObserver.observe(this.content);
|
||||
}
|
||||
this.resize();
|
||||
}
|
||||
var _proto = Dimensions.prototype;
|
||||
_proto.destroy = function destroy() {
|
||||
var _this$wrapperResizeOb, _this$contentResizeOb;
|
||||
(_this$wrapperResizeOb = this.wrapperResizeObserver) == null ? void 0 : _this$wrapperResizeOb.disconnect();
|
||||
(_this$contentResizeOb = this.contentResizeObserver) == null ? void 0 : _this$contentResizeOb.disconnect();
|
||||
};
|
||||
_createClass(Dimensions, [{
|
||||
key: "limit",
|
||||
get: function get() {
|
||||
return {
|
||||
x: this.scrollWidth - this.width,
|
||||
y: this.scrollHeight - this.height
|
||||
};
|
||||
}
|
||||
}]);
|
||||
return Dimensions;
|
||||
}();
|
||||
|
||||
var Emitter = /*#__PURE__*/function () {
|
||||
function Emitter() {
|
||||
this.events = {};
|
||||
}
|
||||
var _proto = Emitter.prototype;
|
||||
_proto.emit = function emit(event) {
|
||||
var callbacks = this.events[event] || [];
|
||||
for (var i = 0, length = callbacks.length; i < length; i++) {
|
||||
callbacks[i].apply(callbacks, [].slice.call(arguments, 1));
|
||||
}
|
||||
};
|
||||
_proto.on = function on(event, cb) {
|
||||
var _this$events$event,
|
||||
_this = this;
|
||||
// Add the callback to the event's callback list, or create a new list with the callback
|
||||
((_this$events$event = this.events[event]) == null ? void 0 : _this$events$event.push(cb)) || (this.events[event] = [cb]);
|
||||
|
||||
// Return an unsubscribe function
|
||||
return function () {
|
||||
var _this$events$event2;
|
||||
_this.events[event] = (_this$events$event2 = _this.events[event]) == null ? void 0 : _this$events$event2.filter(function (i) {
|
||||
return cb !== i;
|
||||
});
|
||||
};
|
||||
};
|
||||
_proto.destroy = function destroy() {
|
||||
this.events = {};
|
||||
};
|
||||
return Emitter;
|
||||
}();
|
||||
|
||||
var VirtualScroll = /*#__PURE__*/function () {
|
||||
function VirtualScroll(element, _ref) {
|
||||
var _this = this;
|
||||
var _ref$wheelMultiplier = _ref.wheelMultiplier,
|
||||
wheelMultiplier = _ref$wheelMultiplier === void 0 ? 1 : _ref$wheelMultiplier,
|
||||
_ref$touchMultiplier = _ref.touchMultiplier,
|
||||
touchMultiplier = _ref$touchMultiplier === void 0 ? 2 : _ref$touchMultiplier,
|
||||
_ref$normalizeWheel = _ref.normalizeWheel,
|
||||
normalizeWheel = _ref$normalizeWheel === void 0 ? false : _ref$normalizeWheel;
|
||||
// Event handler for 'touchstart' event
|
||||
this.onTouchStart = function (event) {
|
||||
var _ref2 = event.targetTouches ? event.targetTouches[0] : event,
|
||||
clientX = _ref2.clientX,
|
||||
clientY = _ref2.clientY;
|
||||
_this.touchStart.x = clientX;
|
||||
_this.touchStart.y = clientY;
|
||||
_this.lastDelta = {
|
||||
x: 0,
|
||||
y: 0
|
||||
};
|
||||
};
|
||||
// Event handler for 'touchmove' event
|
||||
this.onTouchMove = function (event) {
|
||||
var _ref3 = event.targetTouches ? event.targetTouches[0] : event,
|
||||
clientX = _ref3.clientX,
|
||||
clientY = _ref3.clientY;
|
||||
var deltaX = -(clientX - _this.touchStart.x) * _this.touchMultiplier;
|
||||
var deltaY = -(clientY - _this.touchStart.y) * _this.touchMultiplier;
|
||||
_this.touchStart.x = clientX;
|
||||
_this.touchStart.y = clientY;
|
||||
_this.lastDelta = {
|
||||
x: deltaX,
|
||||
y: deltaY
|
||||
};
|
||||
_this.emitter.emit('scroll', {
|
||||
type: 'touch',
|
||||
deltaX: deltaX,
|
||||
deltaY: deltaY,
|
||||
event: event
|
||||
});
|
||||
};
|
||||
this.onTouchEnd = function (event) {
|
||||
_this.emitter.emit('scroll', {
|
||||
type: 'touch',
|
||||
inertia: true,
|
||||
deltaX: _this.lastDelta.x,
|
||||
deltaY: _this.lastDelta.y,
|
||||
event: event
|
||||
});
|
||||
};
|
||||
// Event handler for 'wheel' event
|
||||
this.onWheel = function (event) {
|
||||
var deltaX = event.deltaX,
|
||||
deltaY = event.deltaY;
|
||||
if (_this.normalizeWheel) {
|
||||
deltaX = clamp(-100, deltaX, 100);
|
||||
deltaY = clamp(-100, deltaY, 100);
|
||||
}
|
||||
deltaX *= _this.wheelMultiplier;
|
||||
deltaY *= _this.wheelMultiplier;
|
||||
_this.emitter.emit('scroll', {
|
||||
type: 'wheel',
|
||||
deltaX: deltaX,
|
||||
deltaY: deltaY,
|
||||
event: event
|
||||
});
|
||||
};
|
||||
this.element = element;
|
||||
this.wheelMultiplier = wheelMultiplier;
|
||||
this.touchMultiplier = touchMultiplier;
|
||||
this.normalizeWheel = normalizeWheel;
|
||||
this.touchStart = {
|
||||
x: null,
|
||||
y: null
|
||||
};
|
||||
this.emitter = new Emitter();
|
||||
this.element.addEventListener('wheel', this.onWheel, {
|
||||
passive: false
|
||||
});
|
||||
this.element.addEventListener('touchstart', this.onTouchStart, {
|
||||
passive: false
|
||||
});
|
||||
this.element.addEventListener('touchmove', this.onTouchMove, {
|
||||
passive: false
|
||||
});
|
||||
this.element.addEventListener('touchend', this.onTouchEnd, {
|
||||
passive: false
|
||||
});
|
||||
}
|
||||
|
||||
// Add an event listener for the given event and callback
|
||||
var _proto = VirtualScroll.prototype;
|
||||
_proto.on = function on(event, callback) {
|
||||
return this.emitter.on(event, callback);
|
||||
}
|
||||
|
||||
// Remove all event listeners and clean up
|
||||
;
|
||||
_proto.destroy = function destroy() {
|
||||
this.emitter.destroy();
|
||||
this.element.removeEventListener('wheel', this.onWheel, {
|
||||
passive: false
|
||||
});
|
||||
this.element.removeEventListener('touchstart', this.onTouchStart, {
|
||||
passive: false
|
||||
});
|
||||
this.element.removeEventListener('touchmove', this.onTouchMove, {
|
||||
passive: false
|
||||
});
|
||||
this.element.removeEventListener('touchend', this.onTouchEnd, {
|
||||
passive: false
|
||||
});
|
||||
};
|
||||
return VirtualScroll;
|
||||
}();
|
||||
|
||||
// Technical explaination
|
||||
// - listen to 'wheel' events
|
||||
// - prevent 'wheel' event to prevent scroll
|
||||
// - normalize wheel delta
|
||||
// - add delta to targetScroll
|
||||
// - animate scroll to targetScroll (smooth context)
|
||||
// - if animation is not running, listen to 'scroll' events (native context)
|
||||
var Lenis = /*#__PURE__*/function () {
|
||||
// isScrolling = true when scroll is animating
|
||||
// isStopped = true if user should not be able to scroll - enable/disable programatically
|
||||
// isSmooth = true if scroll should be animated
|
||||
// isLocked = same as isStopped but enabled/disabled when scroll reaches target
|
||||
|
||||
/**
|
||||
* @typedef {(t: number) => number} EasingFunction
|
||||
* @typedef {'vertical' | 'horizontal'} Orientation
|
||||
* @typedef {'vertical' | 'horizontal' | 'both'} GestureOrientation
|
||||
*
|
||||
* @typedef LenisOptions
|
||||
* @property {Orientation} [direction]
|
||||
* @property {GestureOrientation} [gestureDirection]
|
||||
* @property {number} [mouseMultiplier]
|
||||
* @property {boolean} [smooth]
|
||||
*
|
||||
* @property {Window | HTMLElement} [wrapper]
|
||||
* @property {HTMLElement} [content]
|
||||
* @property {Window | HTMLElement} [wheelEventsTarget]
|
||||
* @property {boolean} [smoothWheel]
|
||||
* @property {boolean} [smoothTouch]
|
||||
* @property {boolean} [syncTouch]
|
||||
* @property {number} [syncTouchLerp]
|
||||
* @property {number} [touchInertiaMultiplier]
|
||||
* @property {number} [duration]
|
||||
* @property {EasingFunction} [easing]
|
||||
* @property {number} [lerp]
|
||||
* @property {boolean} [infinite]
|
||||
* @property {Orientation} [orientation]
|
||||
* @property {GestureOrientation} [gestureOrientation]
|
||||
* @property {number} [touchMultiplier]
|
||||
* @property {number} [wheelMultiplier]
|
||||
* @property {boolean} [normalizeWheel]
|
||||
* @property {boolean} [autoResize]
|
||||
*
|
||||
* @param {LenisOptions}
|
||||
*/
|
||||
function Lenis(_temp) {
|
||||
var _this = this;
|
||||
var _ref = _temp === void 0 ? {} : _temp,
|
||||
_ref$wrapper = _ref.wrapper,
|
||||
wrapper = _ref$wrapper === void 0 ? window : _ref$wrapper,
|
||||
_ref$content = _ref.content,
|
||||
content = _ref$content === void 0 ? document.documentElement : _ref$content,
|
||||
_ref$wheelEventsTarge = _ref.wheelEventsTarget,
|
||||
wheelEventsTarget = _ref$wheelEventsTarge === void 0 ? wrapper : _ref$wheelEventsTarge,
|
||||
_ref$smoothWheel = _ref.smoothWheel,
|
||||
smoothWheel = _ref$smoothWheel === void 0 ? true : _ref$smoothWheel,
|
||||
_ref$smoothTouch = _ref.smoothTouch,
|
||||
smoothTouch = _ref$smoothTouch === void 0 ? false : _ref$smoothTouch,
|
||||
_ref$syncTouch = _ref.syncTouch,
|
||||
_syncTouch = _ref$syncTouch === void 0 ? false : _ref$syncTouch,
|
||||
_ref$syncTouchLerp = _ref.syncTouchLerp,
|
||||
syncTouchLerp = _ref$syncTouchLerp === void 0 ? 0.1 : _ref$syncTouchLerp,
|
||||
_ref$__iosNoInertiaSy = _ref.__iosNoInertiaSyncTouchLerp,
|
||||
__iosNoInertiaSyncTouchLerp = _ref$__iosNoInertiaSy === void 0 ? 0.4 : _ref$__iosNoInertiaSy,
|
||||
_ref$touchInertiaMult = _ref.touchInertiaMultiplier,
|
||||
touchInertiaMultiplier = _ref$touchInertiaMult === void 0 ? 35 : _ref$touchInertiaMult,
|
||||
duration = _ref.duration,
|
||||
_ref$easing = _ref.easing,
|
||||
easing = _ref$easing === void 0 ? function (t) {
|
||||
return Math.min(1, 1.001 - Math.pow(2, -10 * t));
|
||||
} : _ref$easing,
|
||||
_ref$lerp = _ref.lerp,
|
||||
lerp = _ref$lerp === void 0 ? duration && 0.1 : _ref$lerp,
|
||||
_ref$infinite = _ref.infinite,
|
||||
infinite = _ref$infinite === void 0 ? false : _ref$infinite,
|
||||
_ref$orientation = _ref.orientation,
|
||||
orientation = _ref$orientation === void 0 ? 'vertical' : _ref$orientation,
|
||||
_ref$gestureOrientati = _ref.gestureOrientation,
|
||||
gestureOrientation = _ref$gestureOrientati === void 0 ? 'vertical' : _ref$gestureOrientati,
|
||||
_ref$touchMultiplier = _ref.touchMultiplier,
|
||||
touchMultiplier = _ref$touchMultiplier === void 0 ? 1 : _ref$touchMultiplier,
|
||||
_ref$wheelMultiplier = _ref.wheelMultiplier,
|
||||
wheelMultiplier = _ref$wheelMultiplier === void 0 ? 1 : _ref$wheelMultiplier,
|
||||
_ref$normalizeWheel = _ref.normalizeWheel,
|
||||
normalizeWheel = _ref$normalizeWheel === void 0 ? false : _ref$normalizeWheel,
|
||||
_ref$autoResize = _ref.autoResize,
|
||||
autoResize = _ref$autoResize === void 0 ? true : _ref$autoResize;
|
||||
this.onVirtualScroll = function (_ref2) {
|
||||
var type = _ref2.type,
|
||||
inertia = _ref2.inertia,
|
||||
deltaX = _ref2.deltaX,
|
||||
deltaY = _ref2.deltaY,
|
||||
event = _ref2.event;
|
||||
// keep zoom feature
|
||||
if (event.ctrlKey) return;
|
||||
var isTouch = type === 'touch';
|
||||
var isWheel = type === 'wheel';
|
||||
if (_this.options.gestureOrientation === 'vertical' && deltaY === 0 ||
|
||||
// trackpad previous/next page gesture
|
||||
_this.options.gestureOrientation === 'horizontal' && deltaX === 0 || isTouch && _this.options.gestureOrientation === 'vertical' && _this.scroll === 0 && !_this.options.infinite && deltaY <= 0 // touch pull to refresh
|
||||
) return;
|
||||
|
||||
// catch if scrolling on nested scroll elements
|
||||
if (!!event.composedPath().find(function (node) {
|
||||
return (node == null ? void 0 : node.hasAttribute == null ? void 0 : node.hasAttribute('data-lenis-prevent')) || isTouch && (node == null ? void 0 : node.hasAttribute == null ? void 0 : node.hasAttribute('data-lenis-prevent-touch')) || isWheel && (node == null ? void 0 : node.hasAttribute == null ? void 0 : node.hasAttribute('data-lenis-prevent-wheel'));
|
||||
})) return;
|
||||
if (_this.isStopped || _this.isLocked) {
|
||||
event.preventDefault();
|
||||
return;
|
||||
}
|
||||
_this.isSmooth = (_this.options.smoothTouch || _this.options.syncTouch) && isTouch || _this.options.smoothWheel && isWheel;
|
||||
if (!_this.isSmooth) {
|
||||
_this.isScrolling = false;
|
||||
_this.animate.stop();
|
||||
return;
|
||||
}
|
||||
event.preventDefault();
|
||||
var delta = deltaY;
|
||||
if (_this.options.gestureOrientation === 'both') {
|
||||
delta = Math.abs(deltaY) > Math.abs(deltaX) ? deltaY : deltaX;
|
||||
} else if (_this.options.gestureOrientation === 'horizontal') {
|
||||
delta = deltaX;
|
||||
}
|
||||
var syncTouch = isTouch && _this.options.syncTouch;
|
||||
var hasTouchInertia = isTouch && inertia && Math.abs(delta) > 1;
|
||||
if (hasTouchInertia) {
|
||||
delta = _this.velocity * _this.options.touchInertiaMultiplier;
|
||||
}
|
||||
_this.scrollTo(_this.targetScroll + delta, _extends({
|
||||
programmatic: false
|
||||
}, syncTouch && {
|
||||
lerp: hasTouchInertia ? _this.syncTouchLerp : _this.options.__iosNoInertiaSyncTouchLerp
|
||||
}));
|
||||
};
|
||||
this.onScroll = function () {
|
||||
if (!_this.isScrolling) {
|
||||
var lastScroll = _this.animatedScroll;
|
||||
_this.animatedScroll = _this.targetScroll = _this.actualScroll;
|
||||
_this.velocity = 0;
|
||||
_this.direction = Math.sign(_this.animatedScroll - lastScroll);
|
||||
_this.emit();
|
||||
}
|
||||
};
|
||||
window.lenisVersion = version;
|
||||
|
||||
// if wrapper is html or body, fallback to window
|
||||
if (wrapper === document.documentElement || wrapper === document.body) {
|
||||
wrapper = window;
|
||||
}
|
||||
this.options = {
|
||||
wrapper: wrapper,
|
||||
content: content,
|
||||
wheelEventsTarget: wheelEventsTarget,
|
||||
smoothWheel: smoothWheel,
|
||||
smoothTouch: smoothTouch,
|
||||
syncTouch: _syncTouch,
|
||||
syncTouchLerp: syncTouchLerp,
|
||||
__iosNoInertiaSyncTouchLerp: __iosNoInertiaSyncTouchLerp,
|
||||
touchInertiaMultiplier: touchInertiaMultiplier,
|
||||
duration: duration,
|
||||
easing: easing,
|
||||
lerp: lerp,
|
||||
infinite: infinite,
|
||||
gestureOrientation: gestureOrientation,
|
||||
orientation: orientation,
|
||||
touchMultiplier: touchMultiplier,
|
||||
wheelMultiplier: wheelMultiplier,
|
||||
normalizeWheel: normalizeWheel,
|
||||
autoResize: autoResize
|
||||
};
|
||||
this.dimensions = new Dimensions({
|
||||
wrapper: wrapper,
|
||||
content: content,
|
||||
autoResize: autoResize
|
||||
});
|
||||
this.rootElement.classList.add('lenis');
|
||||
this.velocity = 0;
|
||||
this.isStopped = false;
|
||||
this.isSmooth = smoothWheel || smoothTouch;
|
||||
this.isScrolling = false;
|
||||
this.targetScroll = this.animatedScroll = this.actualScroll;
|
||||
this.animate = new Animate();
|
||||
this.emitter = new Emitter();
|
||||
this.options.wrapper.addEventListener('scroll', this.onScroll, {
|
||||
passive: false
|
||||
});
|
||||
this.virtualScroll = new VirtualScroll(wheelEventsTarget, {
|
||||
touchMultiplier: touchMultiplier,
|
||||
wheelMultiplier: wheelMultiplier,
|
||||
normalizeWheel: normalizeWheel
|
||||
});
|
||||
this.virtualScroll.on('scroll', this.onVirtualScroll);
|
||||
}
|
||||
var _proto = Lenis.prototype;
|
||||
_proto.destroy = function destroy() {
|
||||
this.emitter.destroy();
|
||||
this.options.wrapper.removeEventListener('scroll', this.onScroll, {
|
||||
passive: false
|
||||
});
|
||||
this.virtualScroll.destroy();
|
||||
this.dimensions.destroy();
|
||||
this.rootElement.classList.remove('lenis');
|
||||
this.rootElement.classList.remove('lenis-smooth');
|
||||
this.rootElement.classList.remove('lenis-scrolling');
|
||||
this.rootElement.classList.remove('lenis-stopped');
|
||||
};
|
||||
_proto.on = function on(event, callback) {
|
||||
return this.emitter.on(event, callback);
|
||||
};
|
||||
_proto.off = function off(event, callback) {
|
||||
var _this$emitter$events$;
|
||||
this.emitter.events[event] = (_this$emitter$events$ = this.emitter.events[event]) == null ? void 0 : _this$emitter$events$.filter(function (i) {
|
||||
return callback !== i;
|
||||
});
|
||||
};
|
||||
_proto.setScroll = function setScroll(scroll) {
|
||||
// apply scroll value immediately
|
||||
if (this.isHorizontal) {
|
||||
this.rootElement.scrollLeft = scroll;
|
||||
} else {
|
||||
this.rootElement.scrollTop = scroll;
|
||||
}
|
||||
};
|
||||
_proto.resize = function resize() {
|
||||
this.dimensions.resize();
|
||||
};
|
||||
_proto.emit = function emit() {
|
||||
this.emitter.emit('scroll', this);
|
||||
};
|
||||
_proto.reset = function reset() {
|
||||
this.isLocked = false;
|
||||
this.isScrolling = false;
|
||||
this.velocity = 0;
|
||||
this.animate.stop();
|
||||
};
|
||||
_proto.start = function start() {
|
||||
this.isStopped = false;
|
||||
this.reset();
|
||||
};
|
||||
_proto.stop = function stop() {
|
||||
this.isStopped = true;
|
||||
this.animate.stop();
|
||||
this.reset();
|
||||
};
|
||||
_proto.raf = function raf(time) {
|
||||
var deltaTime = time - (this.time || time);
|
||||
this.time = time;
|
||||
this.animate.advance(deltaTime * 0.001);
|
||||
};
|
||||
_proto.scrollTo = function scrollTo(target, _temp2) {
|
||||
var _this2 = this;
|
||||
var _ref3 = _temp2 === void 0 ? {} : _temp2,
|
||||
_ref3$offset = _ref3.offset,
|
||||
offset = _ref3$offset === void 0 ? 0 : _ref3$offset,
|
||||
_ref3$immediate = _ref3.immediate,
|
||||
immediate = _ref3$immediate === void 0 ? false : _ref3$immediate,
|
||||
_ref3$lock = _ref3.lock,
|
||||
lock = _ref3$lock === void 0 ? false : _ref3$lock,
|
||||
_ref3$duration = _ref3.duration,
|
||||
duration = _ref3$duration === void 0 ? this.options.duration : _ref3$duration,
|
||||
_ref3$easing = _ref3.easing,
|
||||
easing = _ref3$easing === void 0 ? this.options.easing : _ref3$easing,
|
||||
_ref3$lerp = _ref3.lerp,
|
||||
lerp = _ref3$lerp === void 0 ? !duration && this.options.lerp : _ref3$lerp,
|
||||
_ref3$onComplete = _ref3.onComplete,
|
||||
onComplete = _ref3$onComplete === void 0 ? null : _ref3$onComplete,
|
||||
_ref3$force = _ref3.force,
|
||||
force = _ref3$force === void 0 ? false : _ref3$force,
|
||||
_ref3$programmatic = _ref3.programmatic,
|
||||
programmatic = _ref3$programmatic === void 0 ? true : _ref3$programmatic;
|
||||
if (this.isStopped && !force) return;
|
||||
|
||||
// keywords
|
||||
if (['top', 'left', 'start'].includes(target)) {
|
||||
target = 0;
|
||||
} else if (['bottom', 'right', 'end'].includes(target)) {
|
||||
target = this.limit;
|
||||
} else {
|
||||
var _target;
|
||||
var node;
|
||||
if (typeof target === 'string') {
|
||||
// CSS selector
|
||||
node = document.querySelector(target);
|
||||
} else if ((_target = target) != null && _target.nodeType) {
|
||||
// Node element
|
||||
node = target;
|
||||
}
|
||||
if (node) {
|
||||
if (this.options.wrapper !== window) {
|
||||
// nested scroll offset correction
|
||||
var wrapperRect = this.options.wrapper.getBoundingClientRect();
|
||||
offset -= this.isHorizontal ? wrapperRect.left : wrapperRect.top;
|
||||
}
|
||||
var rect = node.getBoundingClientRect();
|
||||
target = (this.isHorizontal ? rect.left : rect.top) + this.animatedScroll;
|
||||
}
|
||||
}
|
||||
if (typeof target !== 'number') return;
|
||||
target += offset;
|
||||
target = Math.round(target);
|
||||
if (this.options.infinite) {
|
||||
if (programmatic) {
|
||||
this.targetScroll = this.animatedScroll = this.scroll;
|
||||
}
|
||||
} else {
|
||||
target = clamp(0, target, this.limit);
|
||||
}
|
||||
if (immediate) {
|
||||
this.animatedScroll = this.targetScroll = target;
|
||||
this.setScroll(this.scroll);
|
||||
this.reset();
|
||||
this.emit();
|
||||
onComplete == null ? void 0 : onComplete();
|
||||
return;
|
||||
}
|
||||
if (!programmatic) {
|
||||
if (target === this.targetScroll) return;
|
||||
this.targetScroll = target;
|
||||
}
|
||||
this.animate.fromTo(this.animatedScroll, target, {
|
||||
duration: duration,
|
||||
easing: easing,
|
||||
lerp: lerp,
|
||||
onUpdate: function onUpdate(value, _ref4) {
|
||||
var completed = _ref4.completed;
|
||||
// started
|
||||
if (lock) _this2.isLocked = true;
|
||||
_this2.isScrolling = true;
|
||||
|
||||
// updated
|
||||
_this2.velocity = value - _this2.animatedScroll;
|
||||
_this2.direction = Math.sign(_this2.velocity);
|
||||
_this2.animatedScroll = value;
|
||||
_this2.setScroll(_this2.scroll);
|
||||
if (programmatic) {
|
||||
// wheel during programmatic should stop it
|
||||
_this2.targetScroll = value;
|
||||
}
|
||||
|
||||
// completed
|
||||
if (completed) {
|
||||
if (lock) _this2.isLocked = false;
|
||||
requestAnimationFrame(function () {
|
||||
//avoid double scroll event
|
||||
_this2.isScrolling = false;
|
||||
});
|
||||
_this2.velocity = 0;
|
||||
onComplete == null ? void 0 : onComplete();
|
||||
}
|
||||
_this2.emit();
|
||||
}
|
||||
});
|
||||
};
|
||||
_createClass(Lenis, [{
|
||||
key: "rootElement",
|
||||
get: function get() {
|
||||
return this.options.wrapper === window ? this.options.content : this.options.wrapper;
|
||||
}
|
||||
}, {
|
||||
key: "limit",
|
||||
get: function get() {
|
||||
return this.dimensions.limit[this.isHorizontal ? 'x' : 'y'];
|
||||
}
|
||||
}, {
|
||||
key: "isHorizontal",
|
||||
get: function get() {
|
||||
return this.options.orientation === 'horizontal';
|
||||
}
|
||||
}, {
|
||||
key: "actualScroll",
|
||||
get: function get() {
|
||||
// value browser takes into account
|
||||
return this.isHorizontal ? this.rootElement.scrollLeft : this.rootElement.scrollTop;
|
||||
}
|
||||
}, {
|
||||
key: "scroll",
|
||||
get: function get() {
|
||||
return this.options.infinite ? modulo(this.animatedScroll, this.limit) : this.animatedScroll;
|
||||
}
|
||||
}, {
|
||||
key: "progress",
|
||||
get: function get() {
|
||||
// avoid progress to be NaN
|
||||
return this.limit === 0 ? 1 : this.scroll / this.limit;
|
||||
}
|
||||
}, {
|
||||
key: "isSmooth",
|
||||
get: function get() {
|
||||
return this.__isSmooth;
|
||||
},
|
||||
set: function set(value) {
|
||||
if (this.__isSmooth !== value) {
|
||||
this.rootElement.classList.toggle('lenis-smooth', value);
|
||||
this.__isSmooth = value;
|
||||
}
|
||||
}
|
||||
}, {
|
||||
key: "isScrolling",
|
||||
get: function get() {
|
||||
return this.__isScrolling;
|
||||
},
|
||||
set: function set(value) {
|
||||
if (this.__isScrolling !== value) {
|
||||
this.rootElement.classList.toggle('lenis-scrolling', value);
|
||||
this.__isScrolling = value;
|
||||
}
|
||||
}
|
||||
}, {
|
||||
key: "isStopped",
|
||||
get: function get() {
|
||||
return this.__isStopped;
|
||||
},
|
||||
set: function set(value) {
|
||||
if (this.__isStopped !== value) {
|
||||
this.rootElement.classList.toggle('lenis-stopped', value);
|
||||
this.__isStopped = value;
|
||||
}
|
||||
}
|
||||
}]);
|
||||
return Lenis;
|
||||
}();
|
||||
|
||||
return Lenis;
|
||||
|
||||
}));
|
||||
|
||||
127
assets/js/magiccursor.js
Normal file
127
assets/js/magiccursor.js
Normal file
@@ -0,0 +1,127 @@
|
||||
class Cursor {
|
||||
constructor(options) {
|
||||
this.options = $.extend(true, {
|
||||
container: "body",
|
||||
speed: 0.7,
|
||||
ease: "expo.out",
|
||||
visibleTimeout: 300
|
||||
}, options);
|
||||
this.body = $(this.options.container);
|
||||
this.el = $('<div class="cb-cursor"></div>');
|
||||
this.text = $('<div class="cb-cursor-text"></div>');
|
||||
this.init();
|
||||
}
|
||||
|
||||
init() {
|
||||
this.el.append(this.text);
|
||||
this.body.append(this.el);
|
||||
this.bind();
|
||||
this.move(-window.innerWidth, -window.innerHeight, 0);
|
||||
}
|
||||
|
||||
bind() {
|
||||
const self = this;
|
||||
|
||||
this.body.on('mouseleave', () => {
|
||||
self.hide();
|
||||
}).on('mouseenter', () => {
|
||||
self.show();
|
||||
}).on('mousemove', (e) => {
|
||||
this.pos = {
|
||||
x: this.stick ? this.stick.x - ((this.stick.x - e.clientX) * 0.15) : e.clientX,
|
||||
y: this.stick ? this.stick.y - ((this.stick.y - e.clientY) * 0.15) : e.clientY
|
||||
};
|
||||
this.update();
|
||||
}).on('mousedown', () => {
|
||||
self.setState('-active');
|
||||
}).on('mouseup', () => {
|
||||
self.removeState('-active');
|
||||
}).on('mouseenter', 'a,input,textarea,button', () => {
|
||||
self.setState('-pointer');
|
||||
}).on('mouseleave', 'a,input,textarea,button', () => {
|
||||
self.removeState('-pointer');
|
||||
}).on('mouseenter', 'iframe', () => {
|
||||
self.hide();
|
||||
}).on('mouseleave', 'iframe', () => {
|
||||
self.show();
|
||||
}).on('mouseenter', '[data-cursor]', function () {
|
||||
self.setState(this.dataset.cursor);
|
||||
}).on('mouseleave', '[data-cursor]', function () {
|
||||
self.removeState(this.dataset.cursor);
|
||||
}).on('mouseenter', '[data-cursor-text]', function () {
|
||||
self.setText(this.dataset.cursorText);
|
||||
}).on('mouseleave', '[data-cursor-text]', function () {
|
||||
self.removeText();
|
||||
}).on('mouseenter', '[data-cursor-stick]', function () {
|
||||
self.setStick(this.dataset.cursorStick);
|
||||
}).on('mouseleave', '[data-cursor-stick]', function () {
|
||||
self.removeStick();
|
||||
});
|
||||
}
|
||||
|
||||
setState(state) {
|
||||
this.el.addClass(state);
|
||||
}
|
||||
|
||||
removeState(state) {
|
||||
this.el.removeClass(state);
|
||||
}
|
||||
|
||||
toggleState(state) {
|
||||
this.el.toggleClass(state);
|
||||
}
|
||||
|
||||
setText(text) {
|
||||
this.text.html(text);
|
||||
this.el.addClass('-text');
|
||||
}
|
||||
|
||||
removeText() {
|
||||
this.el.removeClass('-text');
|
||||
}
|
||||
|
||||
setStick(el) {
|
||||
const target = $(el);
|
||||
const bound = target.get(0).getBoundingClientRect();
|
||||
this.stick = {
|
||||
y: bound.top + (target.height() / 2),
|
||||
x: bound.left + (target.width() / 2)
|
||||
};
|
||||
this.move(this.stick.x, this.stick.y, 5);
|
||||
}
|
||||
|
||||
removeStick() {
|
||||
this.stick = false;
|
||||
}
|
||||
|
||||
update() {
|
||||
this.move();
|
||||
this.show();
|
||||
}
|
||||
|
||||
move(x, y, duration) {
|
||||
gsap.to(this.el, {
|
||||
x: x || this.pos.x,
|
||||
y: y || this.pos.y,
|
||||
force3D: true,
|
||||
overwrite: true,
|
||||
ease: this.options.ease,
|
||||
duration: this.visible ? (duration || this.options.speed) : 0
|
||||
});
|
||||
}
|
||||
|
||||
show() {
|
||||
if (this.visible) return;
|
||||
clearInterval(this.visibleInt);
|
||||
this.el.addClass('-visible');
|
||||
this.visibleInt = setTimeout(() => this.visible = true);
|
||||
}
|
||||
|
||||
hide() {
|
||||
clearInterval(this.visibleInt);
|
||||
this.el.removeClass('-visible');
|
||||
this.visibleInt = setTimeout(() => this.visible = false, this.options.visibleTimeout);
|
||||
}
|
||||
}
|
||||
// Init cursor
|
||||
const cursor = new Cursor();
|
||||
842
assets/js/main.js
Normal file
842
assets/js/main.js
Normal file
@@ -0,0 +1,842 @@
|
||||
(function ($) {
|
||||
"use strict";
|
||||
|
||||
$(window).on('load', function () {
|
||||
preloader();
|
||||
wowAnimation();
|
||||
|
||||
});
|
||||
|
||||
/*------------------------------------------
|
||||
= preloader
|
||||
-------------------------------------------*/
|
||||
function preloader() {
|
||||
$('#preloader').fadeOut('slow',function(){
|
||||
$(this).remove();
|
||||
});
|
||||
}
|
||||
|
||||
//gasp
|
||||
gsap.config({
|
||||
nullTargetWarn: false,
|
||||
});
|
||||
|
||||
/*------------------------------------------
|
||||
= back to top
|
||||
-------------------------------------------*/
|
||||
$(window).scroll(function () {
|
||||
if ($(this).scrollTop() > 500) {
|
||||
$('.xb-backtotop').addClass('active');
|
||||
} else {
|
||||
$('.xb-backtotop').removeClass('active');
|
||||
}
|
||||
});
|
||||
$(function () {
|
||||
$(".scroll").on('click', function () {
|
||||
$("html,body").animate({ scrollTop: 0 }, "slow");
|
||||
return false
|
||||
});
|
||||
});
|
||||
|
||||
/*------------------------------------------
|
||||
= sticky header
|
||||
-------------------------------------------*/
|
||||
function stickyHeader() {
|
||||
var scrollDirection = "";
|
||||
var lastScrollPosition = 0;
|
||||
|
||||
// Clone and make header sticky if the element with class 'xb-header' exists
|
||||
if ($('.xb-header').length) {
|
||||
$('.xb-header').addClass('original').clone(true).insertAfter('.xb-header').addClass('xb-header-area-sticky xb-sticky-stt').removeClass('original');
|
||||
}
|
||||
|
||||
// Handle scroll events
|
||||
$(window).on("scroll", function () {
|
||||
var currentScrollPosition = $(window).scrollTop();
|
||||
|
||||
// Determine scroll direction
|
||||
scrollDirection = currentScrollPosition < lastScrollPosition ? "up" : "down";
|
||||
lastScrollPosition = currentScrollPosition;
|
||||
|
||||
// Check if element with ID 'xb-header-area' has class 'is-sticky'
|
||||
if ($("#xb-header-area").hasClass("is-sticky")) {
|
||||
// Add or remove classes based on scroll position for sticky header and mobile header
|
||||
if (lastScrollPosition > 100) {
|
||||
$(".xb-header-area-sticky.xb-sticky-stb").addClass("xb-header-fixed");
|
||||
} else {
|
||||
$(".xb-header-area-sticky.xb-sticky-stb").removeClass("xb-header-fixed");
|
||||
}
|
||||
|
||||
// Add or remove classes for sticky header based on scroll direction
|
||||
if (scrollDirection === "up" && lastScrollPosition > 100) {
|
||||
$(".xb-header-area-sticky.xb-sticky-stt").addClass("xb-header-fixed");
|
||||
} else {
|
||||
$(".xb-header-area-sticky.xb-sticky-stt").removeClass("xb-header-fixed");
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
stickyHeader();
|
||||
|
||||
/*------------------------------------------
|
||||
= header search
|
||||
-------------------------------------------*/
|
||||
$(".header-search-btn").on("click", function (e) {
|
||||
e.preventDefault();
|
||||
$(".header-search-form-wrapper").addClass("open");
|
||||
$('.header-search-form-wrapper input[type="search"]').focus();
|
||||
$('.body-overlay').addClass('active');
|
||||
});
|
||||
$(".xb-search-close").on("click", function (e) {
|
||||
e.preventDefault();
|
||||
$(".header-search-form-wrapper").removeClass("open");
|
||||
$("body").removeClass("active");
|
||||
$('.body-overlay').removeClass('active');
|
||||
});
|
||||
|
||||
/*------------------------------------------
|
||||
= sidebar
|
||||
-------------------------------------------*/
|
||||
$('.sidebar-menu-close, .body-overlay').on('click', function () {
|
||||
$('.offcanvas-sidebar').removeClass('active');
|
||||
$('.body-overlay').removeClass('active');
|
||||
});
|
||||
|
||||
$('.offcanvas-sidebar-btn').on('click', function () {
|
||||
$('.offcanvas-sidebar').addClass('active');
|
||||
$('.body-overlay').addClass('active');
|
||||
});
|
||||
$('.body-overlay').on('click', function () {
|
||||
$(this).removeClass('active');
|
||||
$(".header-search-form-wrapper").removeClass("open");
|
||||
});
|
||||
|
||||
|
||||
/*------------------------------------------
|
||||
= mobile menu
|
||||
-------------------------------------------*/
|
||||
$('.xb-nav-hidden li.menu-item-has-children > a').append('<span class="xb-menu-toggle"></span>');
|
||||
$('.xb-header-menu li.menu-item-has-children, .xb-menu-primary li.menu-item-has-children').append('<span class="xb-menu-toggle"></span>');
|
||||
$('.xb-menu-toggle').on('click', function () {
|
||||
if (!$(this).hasClass('active')) {
|
||||
$(this).closest('ul').find('.xb-menu-toggle.active').toggleClass('active');
|
||||
$(this).closest('ul').find('.sub-menu.active').toggleClass('active').slideToggle();
|
||||
}
|
||||
$(this).toggleClass('active');
|
||||
$(this).closest('.menu-item').find('> .sub-menu').toggleClass('active');
|
||||
$(this).closest('.menu-item').find('> .sub-menu').slideToggle();
|
||||
});
|
||||
|
||||
$('.xb-nav-hidden li.menu-item-has-children > a').click(function (e) {
|
||||
var target = $(e.target);
|
||||
if ($(this).attr('href') === '#' && !(target.is('.xb-menu-toggle'))) {
|
||||
e.stopPropagation();
|
||||
if (!$(this).find('.xb-menu-toggle').hasClass('active')) {
|
||||
$(this).closest('ul').find('.xb-menu-toggle.active').toggleClass('active');
|
||||
$(this).closest('ul').find('.sub-menu.active').toggleClass('active').slideToggle();
|
||||
}
|
||||
$(this).find('.xb-menu-toggle').toggleClass('active');
|
||||
$(this).closest('.menu-item').find('> .sub-menu').toggleClass('active');
|
||||
$(this).closest('.menu-item').find('> .sub-menu').slideToggle();
|
||||
}
|
||||
});
|
||||
$(".xb-nav-mobile").on('click', function () {
|
||||
$(this).toggleClass('active');
|
||||
$('.xb-header-menu').toggleClass('active');
|
||||
});
|
||||
|
||||
$(".xb-menu-close, .xb-header-menu-backdrop").on('click', function () {
|
||||
$(this).removeClass('active');
|
||||
$('.xb-header-menu').removeClass('active');
|
||||
});
|
||||
|
||||
/*------------------------------------------
|
||||
= nice select
|
||||
-------------------------------------------*/
|
||||
$('select').niceSelect();
|
||||
|
||||
/*------------------------------------------
|
||||
= data background and bg color
|
||||
-------------------------------------------*/
|
||||
$("[data-background]").each(function () {
|
||||
$(this).css("background-image", "url(" + $(this).attr("data-background") + ") ")
|
||||
})
|
||||
$("[data-bg-color]").each(function () {
|
||||
$(this).css("background-color", $(this).attr("data-bg-color"));
|
||||
|
||||
});
|
||||
|
||||
/*------------------------------------------
|
||||
= aos animation
|
||||
-------------------------------------------*/
|
||||
function wowAnimation() {
|
||||
var wow = new WOW({
|
||||
boxClass: 'wow',
|
||||
animateClass: 'animated',
|
||||
offset: 0,
|
||||
mobile: true,
|
||||
live: true
|
||||
});
|
||||
wow.init();
|
||||
}
|
||||
|
||||
/*------------------------------------------
|
||||
= counter
|
||||
-------------------------------------------*/
|
||||
if ($(".xbo").length) {
|
||||
$('.xbo').appear();
|
||||
$(document.body).on('appear', '.xbo', function (e) {
|
||||
var odo = $(".xbo");
|
||||
odo.each(function () {
|
||||
var countNumber = $(this).attr("data-count");
|
||||
$(this).html(countNumber);
|
||||
});
|
||||
window.xboOptions = {
|
||||
format: 'd',
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
if ($(".xbo_trigger").length) {
|
||||
var odo = $(".xbo_trigger");
|
||||
odo.each(function () {
|
||||
var countNumber = $(this).attr("data-count");
|
||||
var odometerInstance = new Odometer({
|
||||
el: this,
|
||||
value: 0,
|
||||
format: 'd',
|
||||
});
|
||||
odometerInstance.render();
|
||||
odometerInstance.update(countNumber);
|
||||
});
|
||||
$('.xbo_trigger').appear();
|
||||
$(document.body).on('appear', '.xboh', function (e) {
|
||||
});
|
||||
}
|
||||
|
||||
/*------------------------------------------
|
||||
= isotop
|
||||
-------------------------------------------*/
|
||||
$('.grid').imagesLoaded(function () {
|
||||
var $grid = $('.grid').isotope({
|
||||
itemSelector: '.grid-item',
|
||||
percentPosition: true,
|
||||
masonry: {
|
||||
// use outer width of grid-sizer for columnWidth
|
||||
columnWidth: '.grid-item',
|
||||
}
|
||||
});
|
||||
|
||||
// filter items on button click
|
||||
$('.career-menu').on('click', 'button', function () {
|
||||
var filterValue = $(this).attr('data-filter');
|
||||
$grid.isotope({ filter: filterValue });
|
||||
});
|
||||
});
|
||||
|
||||
//for menu active class
|
||||
$('.career-menu button').on('click', function (event) {
|
||||
$(this).siblings('.active').removeClass('active');
|
||||
$(this).addClass('active');
|
||||
event.preventDefault();
|
||||
});
|
||||
|
||||
/*------------------------------------------
|
||||
= Background Parallaxie - Start
|
||||
-------------------------------------------*/
|
||||
$(document).ready(function () {
|
||||
$('.parallaxie').parallaxie({
|
||||
speed: 0.5,
|
||||
offset: 0,
|
||||
});
|
||||
});
|
||||
|
||||
/*------------------------------------------
|
||||
= smooth scroll
|
||||
-------------------------------------------*/
|
||||
const lenis = new Lenis({
|
||||
duration: .8,
|
||||
smoothWheel: true,
|
||||
});
|
||||
|
||||
function raf(time) {
|
||||
lenis.raf(time);
|
||||
requestAnimationFrame(raf);
|
||||
}
|
||||
requestAnimationFrame(raf);
|
||||
|
||||
|
||||
|
||||
/*------------------------------------------
|
||||
= testimonial slide
|
||||
-------------------------------------------*/
|
||||
var slider = new Swiper(".xb-testimonial-slider", {
|
||||
loop: true,
|
||||
speed: 400,
|
||||
spaceBetween: 30,
|
||||
slidesPerView: 5,
|
||||
centeredSlides: false,
|
||||
autoplay: {
|
||||
enabled: true,
|
||||
delay: 6000
|
||||
},
|
||||
breakpoints: {
|
||||
'1700': {
|
||||
slidesPerView: 5,
|
||||
},
|
||||
'1600': {
|
||||
slidesPerView: 4,
|
||||
},
|
||||
'1024': {
|
||||
slidesPerView: 3,
|
||||
},
|
||||
'768': {
|
||||
slidesPerView: 2,
|
||||
},
|
||||
'576': {
|
||||
slidesPerView: 1,
|
||||
},
|
||||
'0': {
|
||||
slidesPerView: 1,
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
/*------------------------------------------
|
||||
= testimonial slide
|
||||
-------------------------------------------*/
|
||||
var slider = new Swiper(".ac-testimonial-slider", {
|
||||
loop: true,
|
||||
speed: 400,
|
||||
spaceBetween: 30,
|
||||
slidesPerView: 3,
|
||||
centeredSlides: false,
|
||||
autoplay: {
|
||||
enabled: true,
|
||||
delay: 6000
|
||||
},
|
||||
breakpoints: {
|
||||
'1600': {
|
||||
slidesPerView: 3,
|
||||
},
|
||||
'1200': {
|
||||
slidesPerView: 3,
|
||||
},
|
||||
'1024': {
|
||||
slidesPerView: 1,
|
||||
},
|
||||
'768': {
|
||||
slidesPerView: 1,
|
||||
},
|
||||
'576': {
|
||||
slidesPerView: 1,
|
||||
},
|
||||
'0': {
|
||||
slidesPerView: 1,
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
/*------------------------------------------
|
||||
= blog slide
|
||||
-------------------------------------------*/
|
||||
var slider = new Swiper(".blog-slider", {
|
||||
loop: true,
|
||||
speed: 400,
|
||||
spaceBetween: 30,
|
||||
slidesPerView: 1,
|
||||
centeredSlides: false,
|
||||
autoplay: {
|
||||
enabled: true,
|
||||
delay: 6000
|
||||
},
|
||||
pagination: {
|
||||
el: ".swiper-pagination",
|
||||
},
|
||||
navigation: {
|
||||
nextEl: ".swiper-button-next",
|
||||
prevEl: ".swiper-button-prev",
|
||||
},
|
||||
breakpoints: {
|
||||
'1600': {
|
||||
slidesPerView: 1,
|
||||
},
|
||||
'1024': {
|
||||
slidesPerView: 1,
|
||||
},
|
||||
'768': {
|
||||
slidesPerView: 1,
|
||||
},
|
||||
'576': {
|
||||
slidesPerView: 1,
|
||||
},
|
||||
'0': {
|
||||
slidesPerView: 1,
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
/*------------------------------------------
|
||||
= ai-testimonial slide
|
||||
-------------------------------------------*/
|
||||
var swiper = new Swiper(".ai-testimonial-slider-nav", {
|
||||
loop: true,
|
||||
spaceBetween: 0,
|
||||
slidesPerView: 1,
|
||||
freeMode: true,
|
||||
effect: "fade",
|
||||
watchSlidesProgress: true,
|
||||
allowTouchMove: true,
|
||||
breakpoints: {
|
||||
'992': {
|
||||
slidesPerView: 1,
|
||||
},
|
||||
'768': {
|
||||
slidesPerView: 1,
|
||||
},
|
||||
'576': {
|
||||
slidesPerView: 1,
|
||||
},
|
||||
'0': {
|
||||
slidesPerView: 1,
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
var swiper2 = new Swiper(".ai-testimonial-slider-img", {
|
||||
loop: true,
|
||||
spaceBetween: 0,
|
||||
slidesPerView: 1,
|
||||
navigation: {
|
||||
nextEl: ".swiper-button-next",
|
||||
prevEl: ".swiper-button-prev",
|
||||
},
|
||||
autoplay: {
|
||||
enabled: true,
|
||||
delay: 6000
|
||||
},
|
||||
thumbs: {
|
||||
swiper: swiper,
|
||||
},
|
||||
});
|
||||
|
||||
|
||||
/*------------------------------------------
|
||||
= inhover active
|
||||
-------------------------------------------*/
|
||||
$(".xb-mouseenter").on('mouseenter', function () {
|
||||
$(".xb-mouseenter").removeClass("active");
|
||||
$(this).addClass("active");
|
||||
});
|
||||
$(".xb-mouseenter2").on('mouseenter', function () {
|
||||
$(".xb-mouseenter2").removeClass("active");
|
||||
$(this).addClass("active");
|
||||
});
|
||||
|
||||
/*------------------------------------------
|
||||
= click button active
|
||||
-------------------------------------------*/
|
||||
$(function () {
|
||||
$('.category li').on('click', function () {
|
||||
var active = $('.category li.active');
|
||||
active.removeClass('active');
|
||||
$(this).addClass('active');
|
||||
});
|
||||
});
|
||||
|
||||
/*------------------------------------------
|
||||
= magnificPopup
|
||||
-------------------------------------------*/
|
||||
$('.popup-image').magnificPopup({
|
||||
type: 'image',
|
||||
gallery: {
|
||||
enabled: true
|
||||
}
|
||||
});
|
||||
$('.popup-video').magnificPopup({
|
||||
type: 'iframe',
|
||||
mainClass: 'mfp-zoom-in',
|
||||
});
|
||||
|
||||
/*------------------------------------------
|
||||
= Accordion Box
|
||||
-------------------------------------------*/
|
||||
if ($(".accordion_box").length) {
|
||||
$(".accordion_box").on("click", ".acc-btn", function () {
|
||||
var outerBox = $(this).parents(".accordion_box");
|
||||
var target = $(this).parents(".accordion");
|
||||
|
||||
if ($(this).next(".acc_body").is(":visible")) {
|
||||
$(this).removeClass("active");
|
||||
$(this).next(".acc_body").slideUp(300);
|
||||
$(outerBox).children(".accordion").removeClass("active-block");
|
||||
} else {
|
||||
$(outerBox).find(".accordion .acc-btn").removeClass("active");
|
||||
$(this).addClass("active");
|
||||
$(outerBox).children(".accordion").removeClass("active-block");
|
||||
$(outerBox).find(".accordion").children(".acc_body").slideUp(300);
|
||||
target.addClass("active-block");
|
||||
$(this).next(".acc_body").slideDown(300);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/*------------------------------------------
|
||||
= marquee
|
||||
-------------------------------------------*/
|
||||
$('.marquee-left').marquee({
|
||||
speed: 20,
|
||||
gap: 0,
|
||||
delayBeforeStart: 0,
|
||||
direction: 'left',
|
||||
duplicated: true,
|
||||
pauseOnHover: false,
|
||||
startVisible: true,
|
||||
});
|
||||
$('.marquee-right').marquee({
|
||||
speed: 20,
|
||||
gap: 0,
|
||||
delayBeforeStart: 0,
|
||||
direction: 'right',
|
||||
duplicated: true,
|
||||
pauseOnHover: false,
|
||||
startVisible: true,
|
||||
});
|
||||
|
||||
/*------------------------------------------
|
||||
= Language Select
|
||||
-------------------------------------------*/
|
||||
const locales = ["en-GB","ar-SA","zh-CN","de-DE","es-ES","fr-FR","hi-IN","it-IT","in-ID","ja-JP","ko-KR","nl-NL","no-NO","pl-PL","pt-BR","sv-SE","fi-FI","th-TH","tr-TR","uk-UA","vi-VN","ru-RU","he-IL"];
|
||||
|
||||
function getFlagSrc(countryCode) {
|
||||
return /^[A-Z]{2}$/.test(countryCode)
|
||||
? `https://flagsapi.com/${countryCode.toUpperCase()}/shiny/64.png`
|
||||
: "";
|
||||
}
|
||||
|
||||
$(document).ready(function () {
|
||||
function setSelectedLocale(locale) {
|
||||
const intlLocale = new Intl.Locale(locale);
|
||||
|
||||
const $dropdownContent = $("#language_dropdown > ul");
|
||||
$dropdownContent.empty();
|
||||
|
||||
const otherLocales = locales.filter(loc => loc !== locale);
|
||||
$.each(otherLocales, function (index, otherLocale) {
|
||||
const otherIntlLocale = new Intl.Locale(otherLocale);
|
||||
const otherLangName = new Intl.DisplayNames([otherLocale], { type: "language" }).of(otherIntlLocale.language);
|
||||
|
||||
const $listEl = $("<li>").html(`${otherLangName} <img src="${getFlagSrc(otherIntlLocale.region)}" />`);
|
||||
$listEl.val(otherLocale);
|
||||
|
||||
$listEl.on("mousedown", function () {
|
||||
setSelectedLocale(otherLocale);
|
||||
});
|
||||
|
||||
$dropdownContent.append($listEl);
|
||||
});
|
||||
|
||||
$("#language_active_btn").html(`<span><img src="${getFlagSrc(intlLocale.region)}" /></span> <i class="fa-solid fa-angle-down"></i>`);
|
||||
}
|
||||
|
||||
setSelectedLocale(locales[0]);
|
||||
|
||||
const browserLang = new Intl.Locale(navigator.language).language;
|
||||
$.each(locales, function (index, locale) {
|
||||
const localeLang = new Intl.Locale(locale).language;
|
||||
if (localeLang === browserLang) {
|
||||
setSelectedLocale(locale);
|
||||
return false; // Break loop
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
/*------------------------------------------
|
||||
= process trigger
|
||||
-------------------------------------------*/
|
||||
document.addEventListener("DOMContentLoaded", function () {
|
||||
const xbProcessItem = document.querySelectorAll(".xb-process-item");
|
||||
const processStep = document.querySelectorAll(".xb-process-step");
|
||||
|
||||
const options = {
|
||||
root: null,
|
||||
threshold: 0.5
|
||||
};
|
||||
|
||||
let observer = new IntersectionObserver(function (entries) {
|
||||
entries.forEach(entry => {
|
||||
if (entry.isIntersecting) {
|
||||
let index = Array.from(xbProcessItem).indexOf(entry.target);
|
||||
|
||||
xbProcessItem.forEach(item => item.classList.remove('active'));
|
||||
processStep.forEach(item => item.classList.remove('active'));
|
||||
|
||||
xbProcessItem[index].classList.add('active');
|
||||
processStep[index].classList.add('active');
|
||||
}
|
||||
});
|
||||
}, options);
|
||||
|
||||
xbProcessItem.forEach(item => {
|
||||
observer.observe(item);
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
/*------------------------------------------
|
||||
= pricing Toggle btn
|
||||
-------------------------------------------*/
|
||||
function priceToggle(){
|
||||
const toggleBtn = document.getElementById('price-toggle-btn');
|
||||
const time = document.getElementById('time');
|
||||
const dollarPrice = document.getElementById('dollar-price');
|
||||
|
||||
if (!toggleBtn || !time || !dollarPrice) return;
|
||||
|
||||
toggleBtn.addEventListener('click', function () {
|
||||
const isActive = this.classList.toggle('active');
|
||||
|
||||
if (isActive) {
|
||||
dollarPrice.innerText = dollarPrice.dataset.priceYear || '';
|
||||
time.innerText = time.dataset.timeYear || '';
|
||||
} else {
|
||||
dollarPrice.innerText = dollarPrice.dataset.priceMonth || '';
|
||||
time.innerText = time.dataset.timeMonth || '';
|
||||
}
|
||||
});
|
||||
}
|
||||
priceToggle();
|
||||
|
||||
/*------------------------------------------
|
||||
= Text reveal With Scroll
|
||||
-------------------------------------------*/
|
||||
if($('.xb-text-reveal').length) {
|
||||
var textheading = $(".xb-text-reveal");
|
||||
|
||||
if(textheading.length == 0) return; gsap.registerPlugin(SplitText); textheading.each(function(index, el) {
|
||||
|
||||
el.split = new SplitText(el, {
|
||||
type: "lines,words,chars",
|
||||
linesClass: "split-line"
|
||||
});
|
||||
|
||||
if( $(el).hasClass('xb-text-reveal') ){
|
||||
gsap.set(el.split.chars, {
|
||||
opacity: .3,
|
||||
x: "-7",
|
||||
});
|
||||
}
|
||||
el.anim = gsap.to(el.split.chars, {
|
||||
scrollTrigger: {
|
||||
trigger: el,
|
||||
start: "top 92%",
|
||||
end: "top 60%",
|
||||
markers: false,
|
||||
scrub: 1,
|
||||
},
|
||||
|
||||
x: "0",
|
||||
y: "0",
|
||||
opacity: 1,
|
||||
duration: .7,
|
||||
stagger: 0.2,
|
||||
});
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
/*------------------------------------------
|
||||
= project section animation
|
||||
-------------------------------------------*/
|
||||
function ptojectScale(){
|
||||
let tl = gsap.timeline();
|
||||
let pr = gsap.matchMedia();
|
||||
pr.add("(min-width: 767px)", () => {
|
||||
let otherSections = document.querySelectorAll('.des-portfolio-panel')
|
||||
otherSections.forEach((section, index) => {
|
||||
gsap.set(otherSections, {
|
||||
scale: 1,
|
||||
});
|
||||
tl.to(section, {
|
||||
scale: .8,
|
||||
scrollTrigger: {
|
||||
trigger: section,
|
||||
pin: section,
|
||||
scrub: 1,
|
||||
start: 'top 0',
|
||||
end: "bottom 60%",
|
||||
endTrigger: '.des-portfolio-wrap',
|
||||
pinSpacing: false,
|
||||
markers: false,
|
||||
},
|
||||
})
|
||||
})
|
||||
});
|
||||
}
|
||||
ptojectScale();
|
||||
|
||||
/*------------------------------------------
|
||||
= auto tab class change animation
|
||||
-------------------------------------------*/
|
||||
document.addEventListener("DOMContentLoaded", function () {
|
||||
let tabs = document.querySelectorAll('.xb-video-nav .nav-link');
|
||||
if (!tabs.length) return;
|
||||
|
||||
let index = 0;
|
||||
let intervalTime = 3000;
|
||||
|
||||
setInterval(() => {
|
||||
index = (index + 1) % tabs.length;
|
||||
|
||||
if (typeof bootstrap !== "undefined" && bootstrap.Tab) {
|
||||
let nextTab = new bootstrap.Tab(tabs[index]);
|
||||
nextTab.show();
|
||||
}
|
||||
}, intervalTime);
|
||||
});
|
||||
|
||||
|
||||
/*------------------------------------------
|
||||
= hover class active and change elements
|
||||
-------------------------------------------*/
|
||||
function brand_animation() {
|
||||
var element = $(".ai-brand-list .current");
|
||||
|
||||
function activeBrandList(e) {
|
||||
if (!e || !e.length) return;
|
||||
|
||||
e.closest("li").removeClass("mleave").addClass("current");
|
||||
e.closest("li").siblings().removeClass("current").addClass("mleave");
|
||||
}
|
||||
|
||||
$(".ai-brand-list li").on("mouseenter", function () {
|
||||
var e = $(this);
|
||||
var index = e.index();
|
||||
|
||||
activeBrandList(e);
|
||||
$(".ai-brand-logo li").removeClass("active").eq(index).addClass("active");
|
||||
});
|
||||
|
||||
$(".ai-brand-list").on("mouseleave", function () {
|
||||
element = $(".ai-brand-list .current");
|
||||
var index = element.index();
|
||||
|
||||
activeBrandList(element);
|
||||
$(".ai-brand-logo li").removeClass("active").eq(index).addClass("active");
|
||||
element.closest("li").siblings().removeClass("mleave");
|
||||
});
|
||||
|
||||
$(".ai-brand-list li").on("click", function () {
|
||||
$(".ai-brand-list li").removeClass("current");
|
||||
$(this).addClass("current");
|
||||
|
||||
var index = $(this).index();
|
||||
$(".ai-brand-logo li").removeClass("active").eq(index).addClass("active");
|
||||
});
|
||||
|
||||
activeBrandList(element);
|
||||
}
|
||||
brand_animation();
|
||||
|
||||
|
||||
/*------------------------------------------
|
||||
= hover class active and change elements
|
||||
-------------------------------------------*/
|
||||
function download_book_animation() {
|
||||
var element = $(".ai-download-book-list .current");
|
||||
|
||||
function activeBookList(e) {
|
||||
if (!e || !e.length) return;
|
||||
|
||||
e.removeClass("mleave").addClass("current");
|
||||
e.siblings().removeClass("current").addClass("mleave");
|
||||
}
|
||||
|
||||
$(".ai-download-book-list .list").on("mouseenter", function () {
|
||||
var e = $(this);
|
||||
var index = e.index();
|
||||
|
||||
activeBookList(e);
|
||||
$(".ai-download-book .book-item").removeClass("active").eq(index).addClass("active");
|
||||
});
|
||||
|
||||
$(".ai-download-book-list").on("mouseleave", function () {
|
||||
element = $(".ai-download-book-list .current");
|
||||
var index = element.index();
|
||||
|
||||
activeBookList(element);
|
||||
$(".ai-download-book .book-item").removeClass("active").eq(index).addClass("active");
|
||||
element.siblings().removeClass("mleave");
|
||||
});
|
||||
|
||||
$(".ai-download-book-list .list").on("click", function () {
|
||||
$(".ai-download-book-list .list").removeClass("current");
|
||||
$(this).addClass("current");
|
||||
|
||||
var index = $(this).index();
|
||||
$(".ai-download-book .book-item").removeClass("active").eq(index).addClass("active");
|
||||
});
|
||||
|
||||
activeBookList(element);
|
||||
}
|
||||
|
||||
download_book_animation();
|
||||
|
||||
|
||||
/*------------------------------------------
|
||||
= project sticky
|
||||
-------------------------------------------*/
|
||||
document.addEventListener("DOMContentLoaded", function () {
|
||||
const items = document.querySelectorAll(".xb-project-item");
|
||||
const paginations = document.querySelectorAll(".xb-project-pagination li");
|
||||
|
||||
if (!items.length || !paginations.length) return;
|
||||
|
||||
items.forEach((item) => {
|
||||
item.style.transition = "opacity 0.6s ease";
|
||||
item.style.opacity = "1";
|
||||
});
|
||||
|
||||
function updateActive() {
|
||||
let indexToActivate = 0;
|
||||
let triggerLine = window.innerHeight * 0.3;
|
||||
|
||||
items.forEach((item, index) => {
|
||||
const rect = item.getBoundingClientRect();
|
||||
if (rect.top <= triggerLine) {
|
||||
indexToActivate = index;
|
||||
}
|
||||
});
|
||||
|
||||
// pagination update
|
||||
paginations.forEach((el) => el.classList.remove("active"));
|
||||
if (paginations[indexToActivate]) {
|
||||
paginations[indexToActivate].classList.add("active");
|
||||
}
|
||||
|
||||
// fade effect
|
||||
items.forEach((item, i) => {
|
||||
if (i === indexToActivate) {
|
||||
item.style.opacity = "1";
|
||||
} else if (i < indexToActivate) {
|
||||
item.style.opacity = "0.3";
|
||||
} else {
|
||||
item.style.opacity = "1";
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
window.addEventListener("scroll", updateActive);
|
||||
updateActive();
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
})(jQuery);
|
||||
|
||||
|
||||
2
assets/js/odometer.min.js
vendored
Normal file
2
assets/js/odometer.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
185
assets/js/parallax-scroll.js
Normal file
185
assets/js/parallax-scroll.js
Normal file
@@ -0,0 +1,185 @@
|
||||
$(function() {
|
||||
ParallaxScroll.init();
|
||||
});
|
||||
|
||||
var ParallaxScroll = {
|
||||
/* PUBLIC VARIABLES */
|
||||
showLogs: false,
|
||||
round: 1000,
|
||||
|
||||
/* PUBLIC FUNCTIONS */
|
||||
init: function() {
|
||||
this._log("init");
|
||||
if (this._inited) {
|
||||
this._log("Already Inited");
|
||||
this._inited = true;
|
||||
return;
|
||||
}
|
||||
this._requestAnimationFrame = (function(){
|
||||
return window.requestAnimationFrame ||
|
||||
window.webkitRequestAnimationFrame ||
|
||||
window.mozRequestAnimationFrame ||
|
||||
window.oRequestAnimationFrame ||
|
||||
window.msRequestAnimationFrame ||
|
||||
function(/* function */ callback, /* DOMElement */ element){
|
||||
window.setTimeout(callback, 1000 / 60);
|
||||
};
|
||||
})();
|
||||
this._onScroll(true);
|
||||
},
|
||||
|
||||
/* PRIVATE VARIABLES */
|
||||
_inited: false,
|
||||
_properties: ['x', 'y', 'z', 'rotateX', 'rotateY', 'rotateZ', 'scaleX', 'scaleY', 'scaleZ', 'scale'],
|
||||
_requestAnimationFrame:null,
|
||||
|
||||
/* PRIVATE FUNCTIONS */
|
||||
_log: function(message) {
|
||||
if (this.showLogs) console.log("Parallax Scroll / " + message);
|
||||
},
|
||||
_onScroll: function(noSmooth) {
|
||||
var scroll = $(document).scrollTop();
|
||||
var windowHeight = $(window).height();
|
||||
this._log("onScroll " + scroll);
|
||||
$("[data-parallax]").each($.proxy(function(index, el) {
|
||||
var $el = $(el);
|
||||
var properties = [];
|
||||
var applyProperties = false;
|
||||
var style = $el.data("style");
|
||||
if (style == undefined) {
|
||||
style = $el.attr("style") || "";
|
||||
$el.data("style", style);
|
||||
}
|
||||
var datas = [$el.data("parallax")];
|
||||
var iData;
|
||||
for(iData = 2; ; iData++) {
|
||||
if($el.data("parallax"+iData)) {
|
||||
datas.push($el.data("parallax-"+iData));
|
||||
}
|
||||
else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
var datasLength = datas.length;
|
||||
for(iData = 0; iData < datasLength; iData ++) {
|
||||
var data = datas[iData];
|
||||
var scrollFrom = data["from-scroll"];
|
||||
if (scrollFrom == undefined) scrollFrom = Math.max(0, $(el).offset().top - windowHeight);
|
||||
scrollFrom = scrollFrom | 0;
|
||||
var scrollDistance = data["distance"];
|
||||
var scrollTo = data["to-scroll"];
|
||||
if (scrollDistance == undefined && scrollTo == undefined) scrollDistance = windowHeight;
|
||||
scrollDistance = Math.max(scrollDistance | 0, 1);
|
||||
var easing = data["easing"];
|
||||
var easingReturn = data["easing-return"];
|
||||
if (easing == undefined || !$.easing|| !$.easing[easing]) easing = null;
|
||||
if (easingReturn == undefined || !$.easing|| !$.easing[easingReturn]) easingReturn = easing;
|
||||
if (easing) {
|
||||
var totalTime = data["duration"];
|
||||
if (totalTime == undefined) totalTime = scrollDistance;
|
||||
totalTime = Math.max(totalTime | 0, 1);
|
||||
var totalTimeReturn = data["duration-return"];
|
||||
if (totalTimeReturn == undefined) totalTimeReturn = totalTime;
|
||||
scrollDistance = 1;
|
||||
var currentTime = $el.data("current-time");
|
||||
if(currentTime == undefined) currentTime = 0;
|
||||
}
|
||||
if (scrollTo == undefined) scrollTo = scrollFrom + scrollDistance;
|
||||
scrollTo = scrollTo | 0;
|
||||
var smoothness = data["smoothness"];
|
||||
if (smoothness == undefined) smoothness = 30;
|
||||
smoothness = smoothness | 0;
|
||||
if (noSmooth || smoothness == 0) smoothness = 1;
|
||||
smoothness = smoothness | 0;
|
||||
var scrollCurrent = scroll;
|
||||
scrollCurrent = Math.max(scrollCurrent, scrollFrom);
|
||||
scrollCurrent = Math.min(scrollCurrent, scrollTo);
|
||||
if(easing) {
|
||||
if($el.data("sens") == undefined) $el.data("sens", "back");
|
||||
if(scrollCurrent>scrollFrom) {
|
||||
if($el.data("sens") == "back") {
|
||||
currentTime = 1;
|
||||
$el.data("sens", "go");
|
||||
}
|
||||
else {
|
||||
currentTime++;
|
||||
}
|
||||
}
|
||||
if(scrollCurrent<scrollTo) {
|
||||
if($el.data("sens") == "go") {
|
||||
currentTime = 1;
|
||||
$el.data("sens", "back");
|
||||
}
|
||||
else {
|
||||
currentTime++;
|
||||
}
|
||||
}
|
||||
if(noSmooth) currentTime = totalTime;
|
||||
$el.data("current-time", currentTime);
|
||||
}
|
||||
this._properties.map($.proxy(function(prop) {
|
||||
var defaultProp = 0;
|
||||
var to = data[prop];
|
||||
if (to == undefined) return;
|
||||
if(prop=="scale" || prop=="scaleX" || prop=="scaleY" || prop=="scaleZ" ) {
|
||||
defaultProp = 1;
|
||||
}
|
||||
else {
|
||||
to = to | 0;
|
||||
}
|
||||
var prev = $el.data("_" + prop);
|
||||
if (prev == undefined) prev = defaultProp;
|
||||
var next = ((to-defaultProp) * ((scrollCurrent - scrollFrom) / (scrollTo - scrollFrom))) + defaultProp;
|
||||
var val = prev + (next - prev) / smoothness;
|
||||
if(easing && currentTime>0 && currentTime<=totalTime) {
|
||||
var from = defaultProp;
|
||||
if($el.data("sens") == "back") {
|
||||
from = to;
|
||||
to = -to;
|
||||
easing = easingReturn;
|
||||
totalTime = totalTimeReturn;
|
||||
}
|
||||
val = $.easing[easing](null, currentTime, from, to, totalTime);
|
||||
}
|
||||
val = Math.ceil(val * this.round) / this.round;
|
||||
if(val==prev&&next==to) val = to;
|
||||
if(!properties[prop]) properties[prop] = 0;
|
||||
properties[prop] += val;
|
||||
if (prev != properties[prop]) {
|
||||
$el.data("_" + prop, properties[prop]);
|
||||
applyProperties = true;
|
||||
}
|
||||
}, this));
|
||||
}
|
||||
if (applyProperties) {
|
||||
if (properties["z"] != undefined) {
|
||||
var perspective = data["perspective"];
|
||||
if (perspective == undefined) perspective = 800;
|
||||
var $parent = $el.parent();
|
||||
if(!$parent.data("style")) $parent.data("style", $parent.attr("style") || "");
|
||||
$parent.attr("style", "perspective:" + perspective + "px; -webkit-perspective:" + perspective + "px; "+ $parent.data("style"));
|
||||
}
|
||||
if(properties["scaleX"] == undefined) properties["scaleX"] = 1;
|
||||
if(properties["scaleY"] == undefined) properties["scaleY"] = 1;
|
||||
if(properties["scaleZ"] == undefined) properties["scaleZ"] = 1;
|
||||
if (properties["scale"] != undefined) {
|
||||
properties["scaleX"] *= properties["scale"];
|
||||
properties["scaleY"] *= properties["scale"];
|
||||
properties["scaleZ"] *= properties["scale"];
|
||||
}
|
||||
var translate3d = "translate3d(" + (properties["x"] ? properties["x"] : 0) + "px, " + (properties["y"] ? properties["y"] : 0) + "px, " + (properties["z"] ? properties["z"] : 0) + "px)";
|
||||
var rotate3d = "rotateX(" + (properties["rotateX"] ? properties["rotateX"] : 0) + "deg) rotateY(" + (properties["rotateY"] ? properties["rotateY"] : 0) + "deg) rotateZ(" + (properties["rotateZ"] ? properties["rotateZ"] : 0) + "deg)";
|
||||
var scale3d = "scaleX(" + properties["scaleX"] + ") scaleY(" + properties["scaleY"] + ") scaleZ(" + properties["scaleZ"] + ")";
|
||||
var cssTransform = translate3d + " " + rotate3d + " " + scale3d + ";";
|
||||
this._log(cssTransform);
|
||||
$el.attr("style", "transform:" + cssTransform + " -webkit-transform:" + cssTransform + " " + style);
|
||||
}
|
||||
}, this));
|
||||
if(window.requestAnimationFrame) {
|
||||
window.requestAnimationFrame($.proxy(this._onScroll, this, false));
|
||||
}
|
||||
else {
|
||||
this._requestAnimationFrame($.proxy(this._onScroll, this, false));
|
||||
}
|
||||
}
|
||||
};
|
||||
66
assets/js/parallaxie.js
Normal file
66
assets/js/parallaxie.js
Normal file
@@ -0,0 +1,66 @@
|
||||
/*! Copyright (c) 2016 THE ULTRASOFT (http://theultrasoft.com)
|
||||
* Licensed under the MIT License (LICENSE.txt).
|
||||
*
|
||||
* Project: Parallaxie
|
||||
* Version: 0.5
|
||||
*
|
||||
* Requires: jQuery 1.9+
|
||||
*/
|
||||
|
||||
(function( $ ){
|
||||
|
||||
$.fn.parallaxie = function( options ){
|
||||
|
||||
options = $.extend({
|
||||
speed: 0.2,
|
||||
repeat: 'no-repeat',
|
||||
size: 'cover',
|
||||
pos_x: 'center',
|
||||
offset: 0,
|
||||
}, options );
|
||||
|
||||
this.each(function(){
|
||||
|
||||
var $el = $(this);
|
||||
var local_options = $el.data('parallaxie');
|
||||
if( typeof local_options !== 'object' ) local_options = {};
|
||||
local_options = $.extend( {}, options, local_options );
|
||||
|
||||
var image_url = $el.data('image');
|
||||
if( typeof image_url === 'undefined' ){
|
||||
image_url = $el.css('background-image');
|
||||
if( !image_url ) return;
|
||||
|
||||
// APPLY DEFAULT CSS
|
||||
var pos_y = local_options.offset + ($el.offset().top - $(window).scrollTop()) * (1 - local_options.speed );
|
||||
$el.css({
|
||||
'background-image': image_url,
|
||||
'background-size': local_options.size,
|
||||
'background-repeat': local_options.repeat,
|
||||
'background-attachment': 'fixed',
|
||||
'background-position': local_options.pos_x + ' ' + pos_y + 'px',
|
||||
});
|
||||
|
||||
|
||||
// Call by default for the first time on initialization.
|
||||
parallax_scroll( $el, local_options );
|
||||
|
||||
// Call by whenever the scroll event occurs.
|
||||
$(window).scroll( function(){
|
||||
parallax_scroll( $el, local_options );
|
||||
});
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
return this;
|
||||
};
|
||||
|
||||
|
||||
function parallax_scroll( $el, local_options ){
|
||||
var pos_y = local_options.offset + ($el.offset().top - $(window).scrollTop()) * (1 - local_options.speed );
|
||||
$el.data( 'pos_y', pos_y );
|
||||
$el.css( 'background-position', local_options.pos_x + ' ' + pos_y + 'px' );
|
||||
}
|
||||
|
||||
}( jQuery ));
|
||||
23
assets/js/plugin.js
Normal file
23
assets/js/plugin.js
Normal file
File diff suppressed because one or more lines are too long
17
assets/js/scrollspy.js
Normal file
17
assets/js/scrollspy.js
Normal file
@@ -0,0 +1,17 @@
|
||||
(function($) {
|
||||
"use strict";
|
||||
|
||||
$('a.scrollspy-btn[href*="#"]:not([href="#"])').on('click', function() {
|
||||
if (location.pathname.replace(/^\//, '') == this.pathname.replace(/^\//, '') && location.hostname == this.hostname) {
|
||||
var target = $(this.hash);
|
||||
target = target.length ? target : $('[name=' + this.hash.slice(1) + ']');
|
||||
if (target.length) {
|
||||
$('html, body').animate({
|
||||
scrollTop: (target.offset().top - 100)
|
||||
}, 1000, "easeInOutExpo");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
})(jQuery); // End of use strict
|
||||
13
assets/js/swiper.min.js
vendored
Normal file
13
assets/js/swiper.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
3
assets/js/wow.min.js
vendored
Normal file
3
assets/js/wow.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user