/** ========================================================================================== Project : Planwey - Responsive Multi-purpose HTML5 Template Version : Bootstrap 4.1.1 Author : Themetechmount ========================================================================================== */ /** =============== 1. Preloader 2. TopSearch 3. Fixed-header 4. Menu 5. Number rotator 6. Skillbar 7. Tab 8. ROcordion 9. Isotope 10. Prettyphoto 11. owlCarousel .. event-slide .. client-logo .. portfolio-slide .. Team slide .. Testimonial slide .. Post-slide .. Post-img-slide 12.client-feedback 13. Back to top 14.timer =============== */ (function($) { 'use strict' /*------------------------------------------------------------------------------*/ /* Preloader /*------------------------------------------------------------------------------*/ // makes sure the whole site is loaded jQuery(window).load(function() { // will first fade out the loading animation jQuery("#status").fadeOut(); // will fade out the whole DIV that covers the website. jQuery("#preloader").delay(1000).fadeOut("slow"); }) /*------------------------------------------------------------------------------*/ /* TopSearch /*------------------------------------------------------------------------------*/ jQuery( ".ttm-header-search-link a" ).addClass('sclose'); jQuery( ".ttm-header-search-link a" ).on('click',function(event ) { if (jQuery('.ttm-header-search-link a').hasClass('sclose')) { jQuery(this).removeClass('sclose').addClass('open'); jQuery(".ttm-search-overlay").addClass('st-show'); jQuery(".ttm-search-overlay").slideDown( 400, function() { jQuery(".field.searchform-s").focus(); }); } else { jQuery(this).removeClass('open').addClass('sclose'); jQuery(".ttm-search-overlay").slideUp( 400, function() { }); } jQuery(".ttm-search-close").on('click',function(){ jQuery('.ttm-header-search-link a').removeClass('st-show').addClass('sclose'); jQuery(".ttm-search-overlay").slideUp(400,function(){}); }); }); /*------------------------------------------------------------------------------*/ /* Fixed-header /*------------------------------------------------------------------------------*/ $(window).scroll(function(){ if ( matchMedia( 'only screen and (min-width: 1200px)' ).matches ) { if ($(window).scrollTop() >= 30 ) { $('.ttm-stickable-header').addClass('fixed-header'); $('.ttm-stickable-header').addClass('visible-title'); } else { $('.ttm-stickable-header').removeClass('fixed-header'); $('ttm-stickable-header').removeClass('visible-title'); } } }); /*------------------------------------------------------------------------------*/ /* Menu /*------------------------------------------------------------------------------*/ $('ul li:has(ul)').addClass('has-submenu'); $('ul li ul').addClass('sub-menu'); $("ul.dropdown li").on({ mouseover: function(){ $(this).addClass("hover"); }, mouseout: function(){ $(this).removeClass("hover"); }, }); var $menu = $('#menu'), $menulink = $('#menu-toggle-form'), $menuTrigger = $('.has-submenu > a'); $menulink.on('click',function (e) { $menulink.toggleClass('active'); $menu.toggleClass('active'); }); $menuTrigger.on('click',function (e) { e.preventDefault(); var t = $(this); t.toggleClass('active').next('ul').toggleClass('active'); }); $('ul li:has(ul)'); /*------------------------------------------------------------------------------*/ /* Animation on scroll: Number rotator /*------------------------------------------------------------------------------*/ $("[data-appear-animation]").each(function() { var self = $(this); var animation = self.data("appear-animation"); var delay = (self.data("appear-animation-delay") ? self.data("appear-animation-delay") : 0); if( $(window).width() > 959 ) { self.html('0'); self.waypoint(function(direction) { if( !self.hasClass('completed') ){ var from = self.data('from'); var to = self.data('to'); var interval = self.data('interval'); self.numinate({ format: '%counter%', from: from, to: to, runningInterval: 2000, stepUnit: interval, onComplete: function(elem) { self.addClass('completed'); } }); } }, { offset:'85%' }); } else { if( animation == 'animateWidth' ) { self.css('width', self.data("width")); } } }); /*------------------------------------------------------------------------------*/ /* Skillbar /*------------------------------------------------------------------------------*/ jQuery('.progress').each(function(){ jQuery(this).find('.progress-bar').animate({ width:jQuery(this).attr('data-value') },6000); }); /*------------------------------------------------------------------------------*/ /* Tab /*------------------------------------------------------------------------------*/ $('.ttm-tabs').each(function() { $(this).children('.content-tab').children().hide(); $(this).children('.content-tab').children().first().show(); $(this).find('.tabs').children('li').on('click', function(e) { var liROtive = $(this).index(), contentROtive = $(this).siblings().removeClass('active').parents('.ttm-tabs').children('.content-tab').children().eq(liROtive); contentROtive.addClass('active').fadeIn('slow'); contentROtive.siblings().removeClass('active'); $(this).addClass('active').parents('.ttm-tabs').children('.content-tab').children().eq(liROtive).siblings().hide(); e.preventDefault(); }); }); /*------------------------------------------------------------------------------*/ /* ROcordion /*------------------------------------------------------------------------------*/ /*https://www.antimath.info/jquery/quick-and-simple-jquery-accordion/*/ $('.toggle').eq(0).addClass('active').find('.toggle-content').css('display','block'); $('.accordion .toggle-title').on('click',function(){ $(this).siblings('.toggle-content').slideToggle('fast'); $(this).parent().toggleClass('active'); $(this).parent().siblings().children('.toggle-content:visible').slideUp('fast'); $(this).parent().siblings().children('.toggle-content:visible').parent().removeClass('active'); }); /*------------------------------------------------------------------------------*/ /* Isotope /*------------------------------------------------------------------------------*/ $(window).on(function(){ var $container = $('#isotopeContainer'); // filter items when filter link is clicked $('#filters a').on(function(){ var selector = $(this).attr('data-filter'); $container.isotope({ filter: selector }); return false; }); var $optionSets = $('#filters li'), $optionLinks = $optionSets.find('a'); $optionLinks.on(function(){ var $this = $(this); // don't proceed if already selected if ( $this.hasClass('selected') ) { return false; } var $optionSet = $this.parents('#filters'); $optionSet.find('.selected').removeClass('selected'); $this.addClass('selected'); // make option object dynamically, i.e. { filter: '.my-filter-class' } var options = {}, key = $optionSet.attr('data-option-key'), value = $this.attr('data-option-value'); // parse 'false' as false boolean value = value === 'false' ? false : value; options[ key ] = value; if ( key === 'layoutMode' && typeof changeLayoutMode === 'function' ) { // changes in layout modes need extra logic changeLayoutMode( $this, options ) } else { // otherwise, apply new options $container.isotope( options ); } return false; }); }); /*------------------------------------------------------------------------------*/ /* Prettyphoto /*------------------------------------------------------------------------------*/ jQuery(document).ready(function(){ // Normal link jQuery('a[href*=".jpg"], a[href*=".jpg"], a[href*=".png"], a[href*=".gif"]').each(function(){ if( jQuery(this).attr('target')!='_blank' && !jQuery(this).hasClass('prettyphoto') && !jQuery(this).hasClass('modula-lightbox') ){ var attr = $(this).attr('data-gal'); if (typeof attr !== typeof undefined && attr !== false && attr!='prettyPhoto' ) { jQuery(this).attr('data-rel','prettyPhoto'); } } }); jQuery('a[data-gal^="prettyPhoto"]').prettyPhoto(); jQuery('a.ttm_prettyphoto').prettyPhoto(); jQuery('a[data-gal^="prettyPhoto"]').prettyPhoto(); jQuery("a[data-gal^='prettyPhoto']").prettyPhoto({hook: 'data-gal'}) }); /*------------------------------------------------------------------------------*/ /* owlCarousel /*------------------------------------------------------------------------------*/ // ===== event-slide ====// $('.event-slide').owlCarousel({ margin:30, nav: $('.event-slide').data('nav'), dots: $('.event-slide').data('dots'), center: $('.event-slide').data('center'), autoplay: $('.event-slide').data('auto'), autoplayHoverPause:true, smartSpeed:1000, autoplayTimeout:3000, loop:true, responsive:{ 0:{ items:1, }, 480:{ items:1, }, 768:{ items:1, }, 992:{ items:2, }, 1200:{ items:2, } } }); // ===== Clients-logo ==== // $(".clients-logo").owlCarousel({ autoplay: $('.clients-logo').data('auto'), nav: $('.clients-logo').data('nav'), dots: $('.clients-logo').data('dots'), margin: 30, loop:true, smartSpeed: 3000, responsiveClass:true, responsive:{ 0:{ items:1, }, 480:{ items:2, }, 768:{ items:3, }, 1024:{ items:5, } } }); // ===== portfolio ====// $(".portfolio-slide").owlCarousel({ autoplay: $('.portfolio-slide').data('auto'), nav: $('.portfolio-slide').data('nav'), dots: $('.portfolio-slide').data('dots'), margin: 0, loop:true, smartSpeed: 3000, responsiveClass:true, responsive:{ 0:{ items:1, }, 480:{ items:2, }, 768:{ items:3, }, 1000:{ items:4, } } }); // ===== Team slide ==== // $(".team-slide").owlCarousel({ loop:true, margin:30, autoplay: $('.team-slide').data('auto'), nav: $('.team-slide').data('nav'), dots: $('.team-slide').data('dots'), smartSpeed: 3000, responsiveClass:true, responsive:{ 0:{ items:1, }, 479:{ items:2, }, 768:{ items:3, }, 992:{ items:3, } } }); // ===== Testimonial slide ==== // $(".testimonial-slide").owlCarousel({ loop:true, margin:0, smartSpeed: 3000, autoplay: $('.testimonial-slide').data('auto'), nav: $('.testimonial-slide').data('nav'), dots: $('.testimonial-slide').data('dots'), responsive:{ 0:{ items:1, nav:false }, 600:{ items:1, nav:false }, 1000:{ items:1, nav:false, loop:true } } }); // ===== Post slide ==== // $(".post-slide").owlCarousel({ loop:true, margin:30, autoplay: $('.post-slide').data('auto'), nav: $('.post-slide').data('nav'), dots: $('.post-slide').data('dots'), smartSpeed: 3000, responsiveClass:true, responsive:{ 0:{ items:1, }, 600:{ items:2, }, 1000:{ items:3, } } }); // ===== post-img==== // $(".post-img-slide").owlCarousel({ autoplay: $('.post-img-slide').data('auto'), nav: $('.post-img-slide').data('nav'), dots: $('.post-img-slide').data('dots'), margin: 30, loop:true, smartSpeed: 1000, responsiveClass:true, responsive:{ 0:{ items:1, }, 480:{ items:1, }, 768:{ items:1, } } }); /*------------------------------------------------------------------------------*/ /* Back to top /*------------------------------------------------------------------------------*/ // ===== Scroll to Top ==== jQuery('#totop').hide(); jQuery(window).scroll(function() { "use strict"; if (jQuery(this).scrollTop() >= 100) { // If page is scrolled more than 50px jQuery('#totop').fadeIn(200); // Fade in the arrow jQuery('#totop').addClass('top-visible'); } else { jQuery('#totop').fadeOut(200); // Else fade out the arrow jQuery('#totop').removeClass('top-visible'); } }); jQuery('#totop').on( "click", function() { // When arrow is clicked jQuery('body,html').animate({ scrollTop : 0 // Scroll to top of body }, 500); return false; }); // ===== timer ==== // function getTimeRemaining(endtime) { var t = Date.parse(endtime) - Date.parse(new Date()); var seconds = Math.floor((t / 1000) % 60); var minutes = Math.floor((t / 1000 / 60) % 60); var hours = Math.floor((t / (1000 * 60 * 60)) % 24); var days = Math.floor(t / (1000 * 60 * 60 * 24)); return { 'total': t, 'days': days, 'hours': hours, 'minutes': minutes, 'seconds': seconds }; } function initializeClock(id, endtime) { var clock = document.getElementById(id); var daysSpan = clock.querySelector('.days'); var hoursSpan = clock.querySelector('.hours'); var minutesSpan = clock.querySelector('.minutes'); var secondsSpan = clock.querySelector('.seconds'); function updateClock() { var t = getTimeRemaining(endtime); daysSpan.innerHTML = t.days; hoursSpan.innerHTML = ('0' + t.hours).slice(-2); minutesSpan.innerHTML = ('0' + t.minutes).slice(-2); secondsSpan.innerHTML = ('0' + t.seconds).slice(-2); if (t.total <= 0) { clearInterval(timeinterval); } } updateClock(); var timeinterval = setInterval(updateClock, 1000); } var deadline = new Date(Date.parse(new Date()) + 15 * 24 * 60 * 60 * 1000); if( jQuery('.timer-box').length>0 ){ initializeClock('timer-box', deadline); } $(function() { }); })(jQuery);