(function ($) { 'use strict'; $(document).ready(function () { const sections = document.querySelectorAll("section"); const navLi = document.querySelectorAll(".navbar #mainNav li"); window.addEventListener("scroll", () => { let current = ""; sections.forEach((section) => { const sectionTop = section.offsetTop; const sectionHeight = section.clientHeight; if (pageYOffset >= sectionTop - sectionHeight / 3) { current = section.getAttribute("id"); } }); navLi.forEach((li) => { li.classList.remove("active"); if (li.classList.contains(current)) { li.classList.add("active"); } }); }); }); var chemin = jQuery(location).attr("pathname"); var test = 0; chemin.includes("politique-confidentialite") ? $('#mainNav .active').removeClass("active") : test=1; chemin.includes("mentions-legales") ? $('#mainNav .active').removeClass("active") : test=0; if (chemin.includes("mentions-legales") || chemin.includes("politique-confidentialite")) { $('#navbar .page-top').on('click', function() {window.location.href = $('#navbar .page-top a').attr("href");}) $('#navbar .about').on('click', function() {window.location.href = $('#navbar .about a').attr("href");}) $('#navbar .service').on('click', function() {window.location.href = $('#navbar .service a').attr("href");}) $('#navbar .feature').on('click', function() {window.location.href = $('#navbar .feature a').attr("href");}) $('#navbar .contact').on('click', function() {window.location.href = $('#navbar .contact a').attr("href");}) $('#page-top .navbar-header').on('click', function() {window.location.href = $('#page-top .navbar-header a').attr("href");}) } // Page Loader Script var window_box = $(window); var document_func = $(document); window_box.on('load', function () { $('body').addClass('loaded'); }); // PreventDefault a click $("a[href='#']").on('click', function ($) { $.preventDefault(); }); // jQuery for page scrolling feature - requires jQuery Easing plugin window_box.on('resize', function () { if (window_box.width() <= 767) { } else { $("a.page-scroll").on('click', function (event) { var height = $("nav").height() - 30; event.preventDefault(); $('html,body').animate({ scrollTop: $(this.hash).offset().top - height }, 1250, 'easeInOutExpo'); }); } }); // Highlight the top nav as scrolling occurs $('body').scrollspy({ target: '.navbar-fixed-top', offset: 50 }); // Closes the Responsive Menu on Menu Item Click $('.navbar-collapse ul li a').on('click', function () { $('.navbar-toggle:visible').click(); }); // Offset for Main Navigation $('.site_header, .site_header_blog').affix({ offset: { top: -1 } }); //jQuery for page scrolling feature - requires jQuery Easing plugin // $(function () { // document_func.on('click', 'a.page-scroll', function (event) { // var $anchor = $(this); // var height = $("nav").height()-10 ; // $('html, body').stop().animate({ // scrollTop: $($anchor.attr('href')).offset().top - height // }, 500, 'easeInOutExpo'); // event.preventDefault(); // }); // }); // Header Search Bar $(function () { /*$('a[href="#search_box"]').on('click', function (event) { event.preventDefault(); $('#search_box').addClass('open'); $('#search_box > form > input[type="search"]').focus(); }); $('#search_box, #search_box button.close').on('click keyup', function (event) { if (event.target === this || event.target.className === 'close' || event.keyCode === 27) { $(this).removeClass('open'); } }); $('form').submit(function (event) { event.preventDefault(); return false; });*/ }); // Back To Top Script window_box.on('scroll', function () { if ($(this).scrollTop() > 100) { $('.scrollup').fadeIn(); } else { $('.scrollup').fadeOut(); } }); $('.scrollup').on('click', function () { $("html, body").animate({ scrollTop: 0 }, 600); return false; }); // Fullscreen Home Slider Active Code window_box.on('resizeEnd', function () { $(".home_slider").height(window_box.height()); }); window_box.on('resize', function () { if (this.resizeTO) clearTimeout(this.resizeTO); this.resizeTO = setTimeout(function () { $(this).trigger('resizeEnd'); }, 300); }).trigger("resize"); var totalItems = $('.slingle_home_slider').length; if (totalItems === 1) { var isLooped = false; var isNav = false; var isDot = false; } else { var isLooped = true; var isNav = true; var isDot = true; } // Partner Logo Footer var partner_slide = $(".partner_slide"); partner_slide.owlCarousel({ loop:true, margin:-1, nav:false, dots:false, autoplay:true, autoplayTimeout:1000, autoplaySpeed:900, lazyLoad:true, singleItem:true, responsive:{ 0:{ items:1 }, 550:{ items:2 }, 751:{ items:3 }, 1001:{ items:4 } } }); var home_slider = $(".home_slider"); home_slider.owlCarousel({ items: 1, margin: 0, loop: isLooped, dots: isDot, nav: isNav, navSpeed: 1300, navText: ['', ''], autoplay: true, animateOut: 'fadeOut', smartSpeed: 450 }); $('.hs_image').hide(); $('.home_slider .slingle_home_slider').each(function () { var itmeImg = $(this).find('.hs_image').attr('src'); $(this).css({ backgroundImage: 'url(' + itmeImg + ')' }); }); var slider_home_item = $('.slingle_home_slider > .slider_area_inner > .container > .row > .col-xs-12 > *'); home_slider.on('translate.owl.carousel', function () { slider_home_item.hide(); }); home_slider.on('translated.owl.carousel', function () { slider_home_item.show(); }); // Home Normal Slider var totalItems = $('.slingle_normal_home_slider').length; if (totalItems === 1) { var isLooped = false; var isNav = false; var isDot = false; } else { var isLooped = true; var isNav = true; var isDot = true; } $('.home_slider_normal').owlCarousel({ loop: isLooped, nav: isNav, dots: isDot, margin: 0, autoplay: true, autoplayTimeout: 3500, autoplayHoverPause: true, navSpeed: 1300, autoplaySpeed: 1300, items: 1, navText: ['', ''], animateOut: 'fadeOut', smartSpeed: 450 }); // Nivo Slider if ($.fn.nivoSlider) { $('#nivoslider').nivoSlider({ effect: 'random', // Specify sets like: 'fold,fade,sliceDown' slices: 15, // For slice animations boxCols: 8, // For box animations boxRows: 4, // For box animations animSpeed: 500, // Slide transition speed pauseTime: 3000, // How long each slide will show startSlide: 0, // Set starting Slide (0 index) directionNav: true, // Next & Prev navigation controlNav: true, // 1,2,3... navigation controlNavThumbs: false, // Use thumbnails for Control Nav pauseOnHover: true, // Stop animation while hovering manualAdvance: false, // Force manual transitions prevText: '', // Prev directionNav text nextText: '', // Next directionNav text randomStart: false // Start on a random slide }); } // Portfolio Pop Script if ($.fn.magnificPopup) { $('#profile_gallery_warp').magnificPopup({ delegate: 'a', type: 'image', removalDelay: 500, //delay removal by X to allow out-animation callbacks: { beforeOpen: function () { this.st.image.markup = this.st.image.markup.replace('mfp-figure', 'mfp-figure mfp-with-anim'); this.st.mainClass = this.st.el.attr('data-effect'); } }, closeOnContentClick: true, midClick: true, tLoading: 'Loading image #%curr%...', mainClass: 'mfp-img-mobile', gallery: { enabled: true, navigateByImgClick: true, preload: [0, 1] }, image: { tError: 'The image #%curr% could not be loaded.' } }); } // Skill Bar Script $('.skillbar').each(function () { var skilldata = $(this).attr('data-percent'); $(this).find('.skillbar-bar').animate({ width: skilldata }, { duration: 3500, easing: 'easeOutCirc' }); $(this).find('.skill-bar-percent').css('marginLeft', '-32px').animate({ left: skilldata }, { duration: 3500, easing: 'easeOutCirc' }); $(this).find('.counter_second').html(skilldata); }); // CounterUp script $('.counter').counterUp({ delay: 10, time: 1000 }); // Testimonial Slider var totalItems = $('.testimonial_item').length; if (totalItems === 1) { var isLooped = false; } else { var isLooped = true; } $('.testimonial_slider').owlCarousel({ loop: isLooped, nav: false, navSpeed: 1300, margin: 0, autoplay: true, autoplayTimeout: 4000, autoplayHoverPause: false, items: 1, animateOut: 'fadeOut', smartSpeed: 450 }); // YouTube video active code if ($.fn.mb_YTPlayer) { $('#video_player').mb_YTPlayer(); } // Bootstrap Custom Select if ($.fn.selectpicker) { $('.selectpicker').selectpicker(); } // WOW Script new WOW().init(); // LOAD GOOGLE MAP var map; var latlng = new google.maps.LatLng(45.454982, 4.398796); var stylez = [{ featureType: "all", elementType: "all", }]; var mapOptions = { zoom: 11, center: latlng, scrollwheel: false, scaleControl: true, disableDefaultUI: true, mapTypeControlOptions: { mapTypeIds: [google.maps.MapTypeId.ROADMAP, 'gMap'] } }; map = new google.maps.Map(document.getElementById("map"), mapOptions); var geocoder_map = new google.maps.Geocoder(); var address = '1 Allee de l\electronique 42000 SAINT ETIENNE'; geocoder_map.geocode({ 'address': address }, function (results, status) { if (status === google.maps.GeocoderStatus.OK) { map.setCenter(results[0].geometry.location); var marker = new google.maps.Marker({ map: map, icon: 'img/map.png', position: map.getCenter() }); // window_box.resize(function () { // if (window_box.width() <= 569) { // map.panBy(0, 0); // } else { // map.panBy(150, 0); // } // }); var infowindow = new google.maps.InfoWindow({ content: '