123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675 |
- /* Template Name: Landrick - Saas & Software Landing Page Template
- Author: Shreethemes
- E-mail: support@shreethemes.in
- Created: August 2019
- Version: 3.5.0
- Updated: July 2021
- File Description: Common JS file of the template(plugins.init.js)
- */
- /*********************************/
- /* INDEX */
- /*================================
- * 01. Tiny Slider *
- * 02. Swiper slider *
- * 03. Countdown Js * (For Comingsoon pages)
- * 04. Maintenance js * (For Maintenance page)
- * 05. Data Counter *
- * 06. Datepicker js *
- * 07. Gallery filter js * (For Portfolio pages)
- * 08. Tobii lightbox * (For Portfolio pages)
- * 09. CK Editor * (For Compose mail)
- * 10. Fade Animation *
- * 11. Typed Text animation (animation) *
- * 12. Validation Form *
- * 13. Switcher Pricing Plan *
- ================================*/
-
- //=========================================//
- /* 01) Tiny slider */
- //=========================================//
- if(document.getElementsByClassName('tiny-single-item').length > 0) {
- var slider = tns({
- container: '.tiny-single-item',
- items: 1,
- controls: false,
- mouseDrag: true,
- loop: true,
- rewind: true,
- autoplay: true,
- autoplayButtonOutput: false,
- autoplayTimeout: 3000,
- navPosition: "bottom",
- speed: 400,
- gutter: 16,
- });
- };
- if(document.getElementsByClassName('tiny-two-item').length > 0) {
- var slider = tns({
- container: '.tiny-two-item',
- controls: false,
- mouseDrag: true,
- loop: true,
- rewind: true,
- autoplay: true,
- autoplayButtonOutput: false,
- autoplayTimeout: 3000,
- navPosition: "bottom",
- speed: 400,
- gutter: 12,
- responsive: {
- 992: {
- items: 2
- },
- 767: {
- items: 2
- },
- 320: {
- items: 1
- },
- },
- });
- };
- if(document.getElementsByClassName('tiny-three-item').length > 0) {
- var slider = tns({
- container: '.tiny-three-item',
- controls: false,
- mouseDrag: true,
- loop: true,
- rewind: true,
- autoplay: true,
- autoplayButtonOutput: false,
- autoplayTimeout: 3000,
- navPosition: "bottom",
- speed: 400,
- gutter: 12,
- responsive: {
- 992: {
- items: 3
- },
- 767: {
- items: 2
- },
- 320: {
- items: 1
- },
- },
- });
- };
- if(document.getElementsByClassName('tiny-four-item').length > 0) {
- var slider = tns({
- container: '.tiny-four-item',
- controls: false,
- mouseDrag: true,
- loop: true,
- rewind: true,
- autoplay: true,
- autoplayButtonOutput: false,
- autoplayTimeout: 3000,
- navPosition: "bottom",
- speed: 400,
- gutter: 12,
- responsive: {
- 992: {
- items: 4
- },
- 767: {
- items: 2
- },
- 320: {
- items: 1
- },
- },
- });
- };
- if(document.getElementsByClassName('roadmaps').length > 0) {
- var slider = tns({
- container: '.roadmaps',
- controls: false,
- mouseDrag: true,
- loop: true,
- rewind: true,
- autoplay: true,
- autoplayButtonOutput: false,
- autoplayTimeout: 3000,
- nav: false,
- speed: 400,
- gutter: 12,
- responsive: {
- 992: {
- items: 4
- },
- 767: {
- items: 2
- },
- 320: {
- items: 1
- },
- },
- });
- };
- if(document.getElementsByClassName('tiny-six-item').length > 0) {
- var slider = tns({
- container: '.tiny-six-item',
- controls: false,
- mouseDrag: true,
- loop: true,
- rewind: true,
- autoplay: true,
- autoplayButtonOutput: false,
- autoplayTimeout: 3000,
- navPosition: "bottom",
- speed: 400,
- gutter: 12,
- responsive: {
- 992: {
- items: 6
- },
- 767: {
- items: 3
- },
- 320: {
- items: 1
- },
- },
- });
- };
- if(document.getElementsByClassName('tiny-twelve-item').length > 0) {
- var slider = tns({
- container: '.tiny-twelve-item',
- controls: true,
- mouseDrag: true,
- loop: true,
- rewind: true,
- autoplay: true,
- autoplayButtonOutput: false,
- autoplayTimeout: 3000,
- navPosition: "bottom",
- controlsText: ['<i class="mdi mdi-chevron-left "></i>', '<i class="mdi mdi-chevron-right"></i>'],
- nav: false,
- speed: 400,
- gutter: 0,
- responsive: {
- 1025: {
- items: 10
- },
- 992: {
- items: 8
- },
- 767: {
- items: 6
- },
- 320: {
- items: 2
- },
- },
- });
- };
- //=========================================//
- /* 02) Swiper slider */
- //=========================================//
- try {
- var menu = [];
- var interleaveOffset = 0.5;
- var swiperOptions = {
- loop: true,
- speed: 1000,
- parallax: true,
- autoplay: {
- delay: 6500,
- disableOnInteraction: false,
- },
- watchSlidesProgress: true,
- pagination: {
- el: '.swiper-pagination',
- clickable: true,
- renderBullet: function (index, className) {
- return '<span class="' + className + '">' + 0 + (index + 1) + '</span>';
- },
- },
- navigation: {
- nextEl: '.swiper-button-next',
- prevEl: '.swiper-button-prev',
- },
- on: {
- progress: function () {
- var swiper = this;
- for (var i = 0; i < swiper.slides.length; i++) {
- var slideProgress = swiper.slides[i].progress;
- var innerOffset = swiper.width * interleaveOffset;
- var innerTranslate = slideProgress * innerOffset;
- swiper.slides[i].querySelector(".slide-inner").style.transform =
- "translate3d(" + innerTranslate + "px, 0, 0)";
- }
- },
- touchStart: function () {
- var swiper = this;
- for (var i = 0; i < swiper.slides.length; i++) {
- swiper.slides[i].style.transition = "";
- }
- },
- setTransition: function (speed) {
- var swiper = this;
- for (var i = 0; i < swiper.slides.length; i++) {
- swiper.slides[i].style.transition = speed + "ms";
- swiper.slides[i].querySelector(".slide-inner").style.transition =
- speed + "ms";
- }
- }
- }
- };
- // DATA BACKGROUND IMAGE
- var swiper = new Swiper(".swiper-container", swiperOptions);
- let data = document.querySelectorAll(".slide-bg-image")
- data.forEach((e) => {
- e.style.backgroundImage =
- `url(${e.getAttribute('data-background')})`;
- })
- } catch (err) {
- }
- //=========================================//
- /*/* 03) Countdown js */
- //=========================================//
- try {
- if(document.getElementById("days")){
- // The data/time we want to countdown to
- var eventCountDown = new Date("December 25, 2022 16:37:52").getTime();
- // Run myfunc every second
- var myfunc = setInterval(function () {
- var now = new Date().getTime();
- var timeleft = eventCountDown - now;
- // Calculating the days, hours, minutes and seconds left
- var days = Math.floor(timeleft / (1000 * 60 * 60 * 24));
- var hours = Math.floor((timeleft % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60));
- var minutes = Math.floor((timeleft % (1000 * 60 * 60)) / (1000 * 60));
- var seconds = Math.floor((timeleft % (1000 * 60)) / 1000);
- // Result is output to the specific element
- document.getElementById("days").innerHTML = days + "<p class='count-head'>Days</p> "
- document.getElementById("hours").innerHTML = hours + "<p class='count-head'>Hours</p> "
- document.getElementById("mins").innerHTML = minutes + "<p class='count-head'>Mins</p> "
- document.getElementById("secs").innerHTML = seconds + "<p class='count-head'>Secs</p> "
- // Display the message when countdown is over
- if (timeleft < 0) {
- clearInterval(myfunc);
- document.getElementById("days").innerHTML = ""
- document.getElementById("hours").innerHTML = ""
- document.getElementById("mins").innerHTML = ""
- document.getElementById("secs").innerHTML = ""
- document.getElementById("end").innerHTML = "00:00:00:00";
- }
- }, 1000);
- }
- } catch (err) {
- }
- //=========================================//
- /*/* 04) Maintenance js */
- //=========================================//
- try {
- if(document.getElementById("maintenance")){
- var seconds = 3599;
- function secondPassed() {
- var minutes = Math.round((seconds - 30) / 60);
- var remainingSeconds = seconds % 60;
- if (remainingSeconds < 10) {
- remainingSeconds = "0" + remainingSeconds;
- }
- document.getElementById('maintenance').innerHTML = minutes + ":" + remainingSeconds;
- if (seconds == 0) {
- clearInterval(countdownTimer);
- document.getElementById('maintenance').innerHTML = "Buzz Buzz";
- } else {
- seconds--;
- }
- }
- var countdownTimer = setInterval('secondPassed()', 1000);
- }
- } catch (err) {
- }
- //=========================================//
- /*/* 05) Data Counter */
- //=========================================//
- try {
- const counter = document.querySelectorAll('.counter-value');
- const speed = 2500; // The lower the slower
- counter.forEach(counter_value => {
- const updateCount = () => {
- const target = +counter_value.getAttribute('data-target');
- const count = +counter_value.innerText;
- // Lower inc to slow and higher to slow
- var inc = target / speed;
- if (inc < 1) {
- inc = 1;
- }
- // Check if target is reached
- if (count < target) {
- // Add inc to count and output in counter_value
- counter_value.innerText = (count + inc).toFixed(0);
- // Call function every ms
- setTimeout(updateCount, 1);
- } else {
- counter_value.innerText = target;
- }
- };
- updateCount();
- });
- } catch (err) {
- }
- //=========================================//
- /*/* 06) Datepicker js*/
- //=========================================//
- try {
- const start = datepicker('.start', { id: 1 })
- const end = datepicker('.end', { id: 1 })
- } catch (err) {
- }
- //=========================================//
- /*/* 07) Gallery filter js */
- //=========================================//
- try {
- var Shuffle = window.Shuffle;
- class Demo {
- constructor(element) {
- if(element){
- this.element = element;
- this.shuffle = new Shuffle(element, {
- itemSelector: '.picture-item',
- sizer: element.querySelector('.my-sizer-element'),
- });
- // Log events.
- this.addShuffleEventListeners();
- this._activeFilters = [];
- this.addFilterButtons();
- }
- }
- /**
- * Shuffle uses the CustomEvent constructor to dispatch events. You can listen
- * for them like you normally would (with jQuery for example).
- */
- addShuffleEventListeners() {
- this.shuffle.on(Shuffle.EventType.LAYOUT, (data) => {
- console.log('layout. data:', data);
- });
- this.shuffle.on(Shuffle.EventType.REMOVED, (data) => {
- console.log('removed. data:', data);
- });
- }
- addFilterButtons() {
- const options = document.querySelector('.filter-options');
- if (!options) {
- return;
- }
- const filterButtons = Array.from(options.children);
- const onClick = this._handleFilterClick.bind(this);
- filterButtons.forEach((button) => {
- button.addEventListener('click', onClick, false);
- });
- }
- _handleFilterClick(evt) {
- const btn = evt.currentTarget;
- const isActive = btn.classList.contains('active');
- const btnGroup = btn.getAttribute('data-group');
- this._removeActiveClassFromChildren(btn.parentNode);
- let filterGroup;
- if (isActive) {
- btn.classList.remove('active');
- filterGroup = Shuffle.ALL_ITEMS;
- } else {
- btn.classList.add('active');
- filterGroup = btnGroup;
- }
- this.shuffle.filter(filterGroup);
- }
- _removeActiveClassFromChildren(parent) {
- const { children } = parent;
- for (let i = children.length - 1; i >= 0; i--) {
- children[i].classList.remove('active');
- }
- }
- }
- document.addEventListener('DOMContentLoaded', () => {
- window.demo = new Demo(document.getElementById('grid'));
- });
- } catch (err) {
- }
- //=========================================//
- /*/* 08) Tobii lightbox */
- //=========================================//
- try {
- const tobii = new Tobii()
- } catch (err) {
- }
- //=========================================//
- /*/* 09) CK Editor */
- //=========================================//
- try {
- ClassicEditor
- .create(document.querySelector('#editor'))
- .catch(error => {
- console.error(error);
- });
- } catch(err) {
- }
- //=========================================//
- /*/* 10) Fade Animation */
- //=========================================//
- try {
- AOS.init({
- easing: 'ease-in-out-sine',
- duration: 1000
- });
- } catch (err) {
- }
- //=========================================//
- /*/* 11) Typed Text animation (animation) */
- //=========================================//
- try {
- var TxtType = function (el, toRotate, period) {
- this.toRotate = toRotate;
- this.el = el;
- this.loopNum = 0;
- this.period = parseInt(period, 10) || 2000;
- this.txt = '';
- this.tick();
- this.isDeleting = false;
- };
- TxtType.prototype.tick = function () {
- var i = this.loopNum % this.toRotate.length;
- var fullTxt = this.toRotate[i];
- if (this.isDeleting) {
- this.txt = fullTxt.substring(0, this.txt.length - 1);
- } else {
- this.txt = fullTxt.substring(0, this.txt.length + 1);
- }
- this.el.innerHTML = '<span class="wrap">' + this.txt + '</span>';
- var that = this;
- var delta = 200 - Math.random() * 100;
- if (this.isDeleting) { delta /= 2; }
- if (!this.isDeleting && this.txt === fullTxt) {
- delta = this.period;
- this.isDeleting = true;
- } else if (this.isDeleting && this.txt === '') {
- this.isDeleting = false;
- this.loopNum++;
- delta = 500;
- }
- setTimeout(function () {
- that.tick();
- }, delta);
- };
- function typewrite() {
- if (toRotate === 'undefined') {
- changeText()
- }
- else
- var elements = document.getElementsByClassName('typewrite');
- for (var i = 0; i < elements.length; i++) {
- var toRotate = elements[i].getAttribute('data-type');
- var period = elements[i].getAttribute('data-period');
- if (toRotate) {
- new TxtType(elements[i], JSON.parse(toRotate), period);
- }
- }
- // INJECT CSS
- var css = document.createElement("style");
- css.type = "text/css";
- css.innerHTML = ".typewrite > .wrap { border-right: 0.08em solid transparent}";
- document.body.appendChild(css);
- };
- window.onload(typewrite());
- } catch(err) {
- }
- //=========================================//
- /*/* 12) Validation Shop Checkouts */
- //=========================================//
- (function () {
- 'use strict'
- if(document.getElementsByClassName('needs-validation').length > 0) {
- // Fetch all the forms we want to apply custom Bootstrap validation styles to
- var forms = document.querySelectorAll('.needs-validation')
- // Loop over them and prevent submission
- Array.prototype.slice.call(forms)
- .forEach(function (form) {
- form.addEventListener('submit', function (event) {
- if (!form.checkValidity()) {
- event.preventDefault()
- event.stopPropagation()
- }
- form.classList.add('was-validated')
- }, false)
- })
- }
- })()
- //=========================================//
- /*/* 13) Switcher Pricing Plans */
- //=========================================//
- try {
- var e = document.getElementById("filt-monthly"),
- d = document.getElementById("filt-yearly"),
- t = document.getElementById("switcher"),
- m = document.getElementById("monthly"),
- y = document.getElementById("yearly");
- e.addEventListener("click", function(){
- t.checked = false;
- e.classList.add("toggler--is-active");
- d.classList.remove("toggler--is-active");
- m.classList.remove("hide");
- y.classList.add("hide");
- });
- d.addEventListener("click", function(){
- t.checked = true;
- d.classList.add("toggler--is-active");
- e.classList.remove("toggler--is-active");
- m.classList.add("hide");
- y.classList.remove("hide");
- });
- t.addEventListener("click", function(){
- d.classList.toggle("toggler--is-active");
- e.classList.toggle("toggler--is-active");
- m.classList.toggle("hide");
- y.classList.toggle("hide");
- })
- } catch(err) {
- }
|