-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
53 changed files
with
5,041 additions
and
0 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Binary file not shown.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,170 @@ | ||
'use strict'; | ||
|
||
|
||
|
||
/** | ||
* PRELOAD | ||
* | ||
* loading will be end after document is loaded | ||
*/ | ||
|
||
const preloader = document.querySelector("[data-preaload]"); | ||
|
||
window.addEventListener("load", function () { | ||
preloader.classList.add("loaded"); | ||
document.body.classList.add("loaded"); | ||
}); | ||
|
||
|
||
|
||
/** | ||
* add event listener on multiple elements | ||
*/ | ||
|
||
const addEventOnElements = function (elements, eventType, callback) { | ||
for (let i = 0, len = elements.length; i < len; i++) { | ||
elements[i].addEventListener(eventType, callback); | ||
} | ||
} | ||
|
||
|
||
|
||
/** | ||
* NAVBAR | ||
*/ | ||
|
||
const navbar = document.querySelector("[data-navbar]"); | ||
const navTogglers = document.querySelectorAll("[data-nav-toggler]"); | ||
const overlay = document.querySelector("[data-overlay]"); | ||
|
||
const toggleNavbar = function () { | ||
navbar.classList.toggle("active"); | ||
overlay.classList.toggle("active"); | ||
document.body.classList.toggle("nav-active"); | ||
} | ||
|
||
addEventOnElements(navTogglers, "click", toggleNavbar); | ||
|
||
|
||
|
||
/** | ||
* HEADER & BACK TOP BTN | ||
*/ | ||
|
||
const header = document.querySelector("[data-header]"); | ||
const backTopBtn = document.querySelector("[data-back-top-btn]"); | ||
|
||
let lastScrollPos = 0; | ||
|
||
const hideHeader = function () { | ||
const isScrollBottom = lastScrollPos < window.scrollY; | ||
if (isScrollBottom) { | ||
header.classList.add("hide"); | ||
} else { | ||
header.classList.remove("hide"); | ||
} | ||
|
||
lastScrollPos = window.scrollY; | ||
} | ||
|
||
window.addEventListener("scroll", function () { | ||
if (window.scrollY >= 50) { | ||
header.classList.add("active"); | ||
backTopBtn.classList.add("active"); | ||
hideHeader(); | ||
} else { | ||
header.classList.remove("active"); | ||
backTopBtn.classList.remove("active"); | ||
} | ||
}); | ||
|
||
|
||
|
||
/** | ||
* HERO SLIDER | ||
*/ | ||
|
||
const heroSlider = document.querySelector("[data-hero-slider]"); | ||
const heroSliderItems = document.querySelectorAll("[data-hero-slider-item]"); | ||
const heroSliderPrevBtn = document.querySelector("[data-prev-btn]"); | ||
const heroSliderNextBtn = document.querySelector("[data-next-btn]"); | ||
|
||
let currentSlidePos = 0; | ||
let lastActiveSliderItem = heroSliderItems[0]; | ||
|
||
const updateSliderPos = function () { | ||
lastActiveSliderItem.classList.remove("active"); | ||
heroSliderItems[currentSlidePos].classList.add("active"); | ||
lastActiveSliderItem = heroSliderItems[currentSlidePos]; | ||
} | ||
|
||
const slideNext = function () { | ||
if (currentSlidePos >= heroSliderItems.length - 1) { | ||
currentSlidePos = 0; | ||
} else { | ||
currentSlidePos++; | ||
} | ||
|
||
updateSliderPos(); | ||
} | ||
|
||
heroSliderNextBtn.addEventListener("click", slideNext); | ||
|
||
const slidePrev = function () { | ||
if (currentSlidePos <= 0) { | ||
currentSlidePos = heroSliderItems.length - 1; | ||
} else { | ||
currentSlidePos--; | ||
} | ||
|
||
updateSliderPos(); | ||
} | ||
|
||
heroSliderPrevBtn.addEventListener("click", slidePrev); | ||
|
||
/** | ||
* auto slide | ||
*/ | ||
|
||
let autoSlideInterval; | ||
|
||
const autoSlide = function () { | ||
autoSlideInterval = setInterval(function () { | ||
slideNext(); | ||
}, 7000); | ||
} | ||
|
||
addEventOnElements([heroSliderNextBtn, heroSliderPrevBtn], "mouseover", function () { | ||
clearInterval(autoSlideInterval); | ||
}); | ||
|
||
addEventOnElements([heroSliderNextBtn, heroSliderPrevBtn], "mouseout", autoSlide); | ||
|
||
window.addEventListener("load", autoSlide); | ||
|
||
|
||
|
||
/** | ||
* PARALLAX EFFECT | ||
*/ | ||
|
||
const parallaxItems = document.querySelectorAll("[data-parallax-item]"); | ||
|
||
let x, y; | ||
|
||
window.addEventListener("mousemove", function (event) { | ||
|
||
x = (event.clientX / window.innerWidth * 10) - 5; | ||
y = (event.clientY / window.innerHeight * 10) - 5; | ||
|
||
// reverse the number eg. 20 -> -20, -5 -> 5 | ||
x = x - (x * 2); | ||
y = y - (y * 2); | ||
|
||
for (let i = 0, len = parallaxItems.length; i < len; i++) { | ||
x = x * Number(parallaxItems[i].dataset.parallaxSpeed); | ||
y = y * Number(parallaxItems[i].dataset.parallaxSpeed); | ||
parallaxItems[i].style.transform = `translate3d(${x}px, ${y}px, 0px)`; | ||
} | ||
|
||
}); |
Oops, something went wrong.
Oops, something went wrong.