/* * Title: BIZSTART | Multipurpose HTML Template * Author: BizStart */ /* [Start contents] 1 preloader js 2 scroll to top js 3 wow js 4 top slider 5 toggle search 6 Isotop And Masonry Active 7 client-slider 8 deal-slider 9 circular progress bar 10 number counter 11 project-slider [End contents] */ (function ($) { "use strict"; var $main_window = $(window); /*==================================== preloader js ======================================*/ $main_window.on('load',function(){ $('#preloader').fadeOut('slow'); }); /*==================================== scroll to top js ======================================*/ $main_window.on('scroll', function () { if ($(this).scrollTop() > 250) { $('#myBtn').fadeIn(200); } else { $('#myBtn').fadeOut(200); } }); $("#myBtn").on("click", function () { $("html, body").animate({ scrollTop: 0 }, "slow"); return false; }); /*==================================== Sticky js ======================================*/ var nav = $('.navbar'); var scrolled = false; $main_window.on('scroll', function () { if (200 < $main_window.scrollTop() && !scrolled) { nav.addClass('sticky_menu animated fadeInDown').animate({ 'margin-top': '0px' }); scrolled = true; } if (200 > $main_window.scrollTop() && scrolled) { nav.removeClass('sticky_menu animated fadeInDown').css('margin-top', '0px'); scrolled = false; } }); /*==================================== wow js ======================================*/ new WOW().init(); /*==================================== easy scroll ======================================*/ $("html").easeScroll({ frameRate: 60, animationTime: 1000, stepSize: 120, pulseAlgorithm: 1, pulseScale: 8, pulseNormalize: 1, accelerationDelta: 20, accelerationMax: 1, keyboardSupport: true, arrowScroll: 50, touchpadSupport: true, fixedBackground: true }); /*==================================== top slider ======================================*/ var mainslider = $('#slider'); mainslider.owlCarousel({ loop: true, margin: 0, items: 1, nav: true, // Show next and prev buttons lazyLoad: false, stopOnHover: false, transitionStyle: "fade", navText: ['', ''], slideSpeed: 2000, autoplay: 500, responsiveClass: true, responsive: { 0: { dots: false, nav: false, }, 992: { dots: true, nav: true, } }, }); // add animate.css class(es) to the elements to be animated function setAnimation(_elem, _InOut) { // Store all animationend event name in a string. // cf animate.css documentation var animationEndEvent = 'webkitAnimationEnd mozAnimationEnd MSAnimationEnd oanimationend animationend'; _elem.each(function () { var $elem = $(this); var $animationType = 'animated ' + $elem.data('animation-' + _InOut); $elem.addClass($animationType).one(animationEndEvent, function () { $elem.removeClass($animationType); // remove animate.css Class at the end of the animations }); }); } // Fired before current slide change mainslider.on('change.owl.carousel', function (event) { var $currentItem = $('.owl-item', mainslider).eq(event.item.index); var $elemsToanim = $currentItem.find("[data-animation-out]"); setAnimation($elemsToanim, 'out'); }); // Fired after current slide has been changed mainslider.on('changed.owl.carousel', function (event) { var $currentItem = $('.owl-item', mainslider).eq(event.item.index); var $elemsToanim = $currentItem.find("[data-animation-in]"); setAnimation($elemsToanim, 'in'); }); /*==================================== toggle search ======================================*/ $('.search a').on("click", function () { $('.search-form').toggleClass('s-active'); }); /*==================================== Isotop And Masonry Active ======================================*/ $main_window.on('load', function () { $('.isotop-active').masonry({ // options itemSelector: '.grid-item', }); if ($.fn.isotope) { $(".isotop-active").isotope({ filter: '*', }); $('.project-nav ul li').on('click', function () { $(".project-nav ul li").removeClass("active"); $(this).addClass("active"); var selector = $(this).attr('data-filter'); $(".isotop-active").isotope({ filter: selector, animationOptions: { duration: 750, easing: 'easeOutCirc', queue: false, } }); return false; }); } }); /*==================================== client-slider ======================================*/ $("#client-slider").owlCarousel({ loop: true, margin: 0, items: 1, nav: false, slideSpeed: 500, autoplay: true, paginationSpeed: 300, }); /*==================================== deal-slider ======================================*/ $("#deal-slider").owlCarousel({ margin: 30, items: 5, nav: false, autoplay: true, smartSpeed: 1000, loop: true, responsiveClass: true, responsive: { 0: { items: 1, dots: false }, 400: { items: 2, margin: 5, dots: false, }, 600: { items: 5, margin: 15 }, 1000: { items: 5, } }, }); /*==================================== circular progress bar ======================================*/ $(function () { if ($(".skill").length > 0) { var a = 0; $main_window.on('scroll', function () { var oTop = $('.skill').offset().top - window.innerHeight; if (a === 0 && $main_window.scrollTop() > oTop) { $('.dial').each(function () { var elm = $(this); var color = elm.attr("data-fgColor"); var perc = elm.attr("value"); elm.knob({ 'value': 0, 'min': 0, 'max': 100, "skin": "tron", "readOnly": true, "thickness": 0.2, 'dynamicDraw': true, "displayInput": false }); $({ value: 0 }).animate({ value: perc }, { duration: 3000, easing: 'swing', progress: function () { elm.val(Math.ceil(this.value)).trigger('change'); } }); //circular progress bar color $(this).append(function () { elm.parent().parent().find('.circular-bar-content').css('color', color); elm.parent().parent().find('.circular-bar-content label').text(perc + '%'); }); }); a = 1; } }); } }); /*======================================= number counter ======================================= */ var $counter_div = $('.counter'); if ($counter_div.length > 0) { $counter_div.counterUp({ delay: 10, time: 2000 }); } /*========================== projct-slider =============================*/ var sync1 = $("#projct-slide-1"); var sync2 = $("#projct-slide-2"); var slidesPerPage = 4; var syncedSecondary = true; sync1.owlCarousel({ items: 1, slideSpeed: 2000, nav: false, autoplay: true, dots: false, loop: true, responsiveRefreshRate: 200, }).on('changed.owl.carousel', syncPosition); sync2.on('initialized.owl.carousel', function () { sync2.find(".owl-item").eq(0).addClass("current"); }).owlCarousel({ items: slidesPerPage, dots: false, nav: false, smartSpeed: 200, slideSpeed: 500, slideBy: slidesPerPage, responsiveRefreshRate: 100 }).on('changed.owl.carousel', syncPosition2); function syncPosition(el) { var count = el.item.count - 1; var current = Math.round(el.item.index - (el.item.count / 2) - 0.5); if (current < 0) { current = count; } if (current > count) { current = 0; } sync2.find(".owl-item").removeClass("current").eq(current).addClass("current"); var onscreen = sync2.find('.owl-item.active').length - 1; var start = sync2.find('.owl-item.active').first().index(); var end = sync2.find('.owl-item.active').last().index(); if (current > end) { sync2.data('owl.carousel').to(current, 100, true); } if (current < start) { sync2.data('owl.carousel').to(current - onscreen, 100, true); } } function syncPosition2(el) { if (syncedSecondary) { var number = el.item.index; sync1.data('owl.carousel').to(number, 100, true); } } sync2.on("click", ".owl-item", function (e) { e.preventDefault(); var number = $(this).index(); sync1.data('owl.carousel').to(number, 300, true); }); })(jQuery); /*========================== google map =============================*/ function initMap() { var map = new google.maps.Map(document.getElementById("map"), { zoom: 7, center: { lat: 29.391277, lng: 75.432617 } }); }