jquery(function ($) { 'use strict'; // ------------------------------------------------------------- // offcanvas menu �������أ�http://www.bootstrapmb.com // ------------------------------------------------------------- (function () { var menutoggle = $(".menu-toggle"); var offcanvasmenu = $("#offcanvas-menu"); var closemenu = $(".close-menu"); menutoggle.on("click" ,function(){ offcanvasmenu.addclass("toggled"); return false; }); closemenu.on("click" ,function() { offcanvasmenu.removeclass("toggled"); return false; }); }()); // ------------------------------------------------------------- // single-page-menu-scrolling easy plugin // ------------------------------------------------------------- $(function() { $('a.page-scroll').on('click', function(event) { var $anchor = $(this); $('html, body').stop().animate({ scrolltop: $($anchor.attr('href')).offset().top }, 1500, 'easeinoutexpo'); event.preventdefault(); }); }); // ------------------------------------------------------------- // sub-menu // ------------------------------------------------------------- if ( $('.dropmenu').length) { $('.dropmenu').on("click" ,function(){ $(this).parent().find('ul').slidetoggle(); return false; }); } // ------------------------------------------------------------- // burger menu // ------------------------------------------------------------- (function () { var menusearch = $(".menu-search"); var openmenu = $(".open-menu"); var burgermenu = $("#burger-menu"); var closemenu = $(".close-menu"); openmenu.on("click" ,function(){ menusearch.addclass("action"); burgermenu.addclass("active"); return false; }); closemenu.on("click" ,function() { menusearch.removeclass("action"); burgermenu.removeclass("active"); return false; }); }()); // ------------------------------------------------------------- // search bar // ------------------------------------------------------------- (function () { var openbar = $(".open-bar"); var searchbar = $("#search-bar"); var closebar = $(".close-bar"); var arrow = $(".arrow"); openbar.on("click" ,function(){ searchbar.addclass("active"); arrow.addclass("active"); return false; }); closebar.on("click" ,function() { searchbar.removeclass("active"); arrow.removeclass("active"); return false; }); }()); // ------------------------------------------------------------- // lightbox-js // ------------------------------------------------------------- if ($('#lightbox').length) { $('#lightbox').poptrox({ usepopupcaption: true, usepopupnav: true, popuppadding: 0 }); } // ------------------------------------------------------------- // background-color-change // ------------------------------------------------------------- function colorchangeanimation() { var section = $(".review-section"); var home = $(".homepageone"); var about = $(".aboutpage"); // var nextsection = section.next(); var top = section.offset().top; if ($(window).scrolltop() >= top && $(window).innerwidth() > 992) { section.addclass("active-bg"); home.addclass("active-bg"); about.addclass("active-bg"); } else { section.removeclass("active-bg"); home.removeclass("active-bg"); about.removeclass("active-bg"); } } // ------------------------------------------------------------- // single-item-parallax // ------------------------------------------------------------- function bgparallax() { if ($(".section-caption").length) { $(".section-caption").each(function() { var height = $(this).position().top; var resize = height - $(window).scrolltop(); var doparallax = -(resize/5); var positionvalue = doparallax + "px"; var img = $(this).data("bg-image"); $(this).css({ backgroundimage: "url(" + img + ")", backgroundposition: "50%" + positionvalue, }); }); } } // ------------------------------------------------------------------ // revulation slider // ------------------------------------------------------------------ if ($('.tp-banner').length) { $('.tp-banner').revolution({ delay:9000, startwidth:1170, startheight:750, hidethumbs:10, fullwidth:"on", forcefullwidth:"on", onhoverstop:"off", navigationtype:"none", navigationstyle:"preview2", spinner:"off", hidetimerbar:"on" }); } // ------------------------------------------------------------- // client-slider // ------------------------------------------------------------- if ($('.client-carousel').length) { $('.client-carousel').owlcarousel({ loop:true, autoplay:true, autoplaytimeout: 2000, margin:30, nav:true, responsive:{ 0:{ items:1, nav:false, dots:false, }, 600:{ items:3, nav:false, dots:false, }, 1000:{ items:5 } } }); } // ------------------------------------------------------------- // project-slider // ------------------------------------------------------------- if ($('.project-carousel').length) { $('.project-carousel').slick({ centermode: true, centerpadding: '300px', slidestoshow: 1, margin:30, arrows: true, responsive: [ { breakpoint: 2100, settings: { arrows: true, centermode: true, centerpadding: '500px', slidestoshow: 1 } }, { breakpoint: 1500, settings: { arrows: true, centermode: true, centerpadding: '300px', slidestoshow: 1 } }, { breakpoint: 991, settings: { arrows: true, centermode: true, centerpadding: '200px', slidestoshow: 1 } }, { breakpoint: 768, settings: { arrows: true, centermode: true, centerpadding: '100px', slidestoshow: 1 } }, { breakpoint: 480, settings: { arrows: false, centermode: true, centerpadding: '40px', slidestoshow: 1 } } ] }); } // ------------------------------------------------------------- // google map // ------------------------------------------------------------- //if ($('#googlemap').length) { // google.maps.event.adddomlistener(window, 'load', init); // function init() { // var mapoptions = { // // how zoomed in you want the map to start at (always required) // zoom: 15, // scrollwheel: false, // // the latitude and longitude to center the map (always required) // center: new google.maps.latlng(36.169941, -115.139830), // new york // // this is where you would paste any style found on snazzy maps. // styles:[{"featuretype": "all","elementtype": "labels.text.fill","stylers": [{"saturation": 36},{"color": "#333333"},{"lightness": 40}]}, // {"featuretype": "all","elementtype": "labels.text.stroke","stylers": [{"visibility": "on"},{"color": "#ffffff"},{"lightness": 16}]}, // {"featuretype": "all","elementtype": "labels.icon","stylers": [{"visibility": "off"}]}, // {"featuretype": "administrative","elementtype": "geometry.fill","stylers": [{"color": "#fefefe"},{"lightness": 20}]}, // {"featuretype": "administrative","elementtype": "geometry.stroke","stylers": [{"color": "#fefefe"},{"lightness": 17},{"weight": 1.2}]}, // {"featuretype": "landscape","elementtype": "geometry","stylers": [{"color": "#f5f5f5"},{"lightness": 20}]}, // {"featuretype": "poi","elementtype": "geometry","stylers": [{"color": "#f5f5f5"},{"lightness": 21}]}, // {"featuretype": "poi.park","elementtype": "geometry","stylers": [{"color": "#dedede"},{"lightness": 21}]}, // {"featuretype": "road.highway","elementtype": "geometry.fill","stylers": [{"color": "#ffffff"},{"lightness": 17}]}, // {"featuretype": "road.highway","elementtype": "geometry.stroke","stylers": [{"color": "#ffffff"},{"lightness": 29},{"weight": 0.2}]}, // {"featuretype": "road.arterial","elementtype": "geometry","stylers": [{"color": "#ffffff"},{"lightness": 18}]}, // {"featuretype": "road.local","elementtype": "geometry","stylers": [{"color": "#ffffff"},{"lightness": 16}]}, // {"featuretype": "transit","elementtype": "geometry","stylers": [{"color": "#f2f2f2"},{"lightness": 19}]}, // {"featuretype": "water","elementtype": "geometry","stylers": [{"color": "#e9e9e9"},{"lightness": 17}]}]}; // // get the html dom element that will contain your map // var mapelement = document.getelementbyid('googlemap'); // // create the google map using our element and options defined above // var map = new google.maps.map(mapelement, mapoptions); // // let's also add a marker while we're at it // var marker = new google.maps.marker({ // position: new google.maps.latlng(36.169941, -115.139830), // map: map, // title: 'snazzy!' // }); // } //} // ------------------------------------------------------------- // back to top // ------------------------------------------------------------- function backtotopbtnappear() { if ($("#totop").length) { var windowpos = $(window).scrolltop(), backtotopbtn = $("#totop"); if (windowpos > 4000) { backtotopbtn.fadein(); } else { backtotopbtn.fadeout(); } } } function backtotop() { if ($("#totop").length) { var backtotopbtn = $("#totop"); backtotopbtn.on("click", function() { $("html, body").animate({ scrolltop: 0 }, 1000); return false; }) } } // ------------------------------------------------------------- // wow animation // ------------------------------------------------------------- new wow().init(); // ------------------------------------------------------------- // preloader // ------------------------------------------------------------- function preloader() { if ($('#preloader').length) { $('#preloader').delay(100).fadeout('slow' , function () {}); } } // ------------------------------------------------------------- // when window load // ------------------------------------------------------------- $(window).on("load", function() { preloader(); thmswiperinit(); new wow().init(); backtotop(); bgparallax(); }) function thmswiperinit() { // swiper slider const swiperelm = document.queryselectorall(".thm-swiper__slider"); swiperelm.foreach(function (swiperelm) { const swiperoptions = json.parse(swiperelm.dataset.swiperoptions); let thmswiperslider = new swiper(swiperelm, swiperoptions); }); } function thmtinyinit() { // tiny slider const tinyelm = document.queryselectorall(".thm-tiny__slider"); tinyelm.foreach(function (tinyelm) { const tinyoptions = json.parse(tinyelm.dataset.tinyoptions); let thmtinyslider = tns(tinyoptions); }); } function thmtestimonialsthumbcarousel() { if ($("#testimonials-one__thumb").length) { let testimonialsthumb = new swiper("#testimonials-one__thumb", { slidesperview: 3, spacebetween: 0, speed: 1400, watchslidesvisibility: true, watchslidesprogress: true, autoplay: { delay: 5000 } }); let testimonialscarousel = new swiper("#testimonials-one__carousel", { observer: true, observeparents: true, speed: 1400, mousewheel: true, slidesperview: 1, autoplay: { delay: 5000 }, thumbs: { swiper: testimonialsthumb } }); } } /* magnificpopup img view */ $('.popup-image').magnificpopup({ type: 'image', gallery: { enabled: true } }); /* magnificpopup video view */ $(".popup-video").magnificpopup({ type: "iframe", }); // ------------------------------------------------------------- // when window scroll // ------------------------------------------------------------- $(window).on("scroll", function() { backtotopbtnappear(); if ($(".review-section").length) { colorchangeanimation(); } bgparallax(); }); }); // jquery-end