/*-------------------------------------------------- Project: intechno Version: 1.0 Author: Company Name ----------------------------------------------------- JS INDEX ================================================ * Scrolling tab menu * Main Home Slider * Testimonial slider * Project Slider * Page Loader * Scroll To Top * Counter * Google-Map ================================================*/ (function(jQuery) { "use strict"; /*==================================== Scrolling tab menu ======================================*/ var topMenu = jQuery(".nav#top-menu"), topMenuHeight = topMenu.outerHeight() + 100; // Bind click handler to menu items topMenu.on("click", 'a', function(e) { var href = jQuery(this).attr("href"), offsetTop = href === "#" ? 0 : $(href).offset().top - topMenuHeight + 80; jQuery('html, body').stop().animate({ scrollTop: offsetTop }, 300); e.preventDefault(); }); // Bind to scroll jQuery(window).on("scroll", function() { // All list items var menuItems = topMenu.find("a"); // Anchors corresponding to menu items var scrollItems = menuItems.map(function() { var item = jQuery(jQuery(this).attr("href")); if (item.length) { return item; } }); // Get container scroll position var fromTop = jQuery(this).scrollTop() + topMenuHeight; // Get id of current scroll item var cur = scrollItems.map(function() { if (jQuery(this).offset().top < fromTop) return this; }); // Get the id of the current element cur = cur[cur.length - 1]; var id = cur && cur.length ? cur[0].id : ""; var lastId; if (lastId !== id) { lastId = id; // Set remove active class menuItems .parent().removeClass("active") .end().filter("[href='#" + id + "']").parent().addClass("active"); } }); // on scroll fix navbar /*var windows = jQuery(window); var sticky = jQuery('.navbar-default') windows.on('scroll', function() { var scroll = windows.scrollTop(); if (scroll < 50) { sticky.removeClass('h_stiky'); } else { sticky.addClass('h_stiky'); } });*/ /*==================================== Scroll To Top =====================================*/ // Scroll to Top = jQuery(window).on("scroll", function() { if (jQuery(this).scrollTop() >= 50) { jQuery('#return-to-top').fadeIn(200); } else { jQuery('#return-to-top').fadeOut(200); } }); jQuery('#return-to-top').on('click', function() { jQuery('body,html').animate({ scrollTop: 0 }, 500); }); jQuery(document).ready(function() { jQuery(".navbar-nav").accessibleDropDown(); }); jQuery.fn.accessibleDropDown = function () { var el = jQuery(this); /* Make dropdown menus keyboard accessible */ jQuery("a", el).focus(function() { jQuery(this).parents("li").addClass("force-show"); }).blur(function() { jQuery(this).parents("li").removeClass("force-show"); }); } /*==================================== Dropdown Click ======================================*/ jQuery('.menu-item-has-children').on('click', function () { jQuery('.menu-item-has-children .sub-menu').toggleClass('current'); }); /*==================================== slick nav ======================================*/ var logo_path = jQuery('.mobile-menu').data('logo'); var logo_link = jQuery('.mobile-menu').data('link'); var logo_type = jQuery('.mobile-menu').data('type'); let logo; if (logo_type === 'text') { logo = ''; }else { logo = 'logo';; } jQuery('.navbar-nav').slicknav({ appendTo: '.mobile-menu', removeClasses: true, label: '', closedSymbol: '', openedSymbol: '', brand: logo }); function intechno_toggle_icon_burger() { const list = document.querySelectorAll(".slicknav_nav li a"); // get first element to be focused inside modal const firstFocusableElement = document.getElementById('slicknav_btnn'); const logo = document.querySelector('.navbar-brand'); const firstFocusableElementclass = document.querySelector('.slicknav_collapsed'); // get last element to be focused inside modal const last = list[list.length - 1]; const lastFocusableElement = last; document.addEventListener('keydown', function (e) { let isTabPressed = e.key === 'Tab' || e.keyCode === 9; if (!isTabPressed) { return; } if(event.shiftKey && event.keyCode == 9 && document.activeElement === firstFocusableElement) { lastFocusableElement.focus(); e.preventDefault(); } if(event.shiftKey && event.keyCode == 9 && document.activeElement === firstFocusableElementclass) { logo.focus(); e.preventDefault(); } // if shift key pressed for shift + tab combination if (e.shiftKey) { if (document.activeElement === firstFocusableElement) { lastFocusableElement.focus(); e.preventDefault(); } } else { if (document.activeElement === lastFocusableElement) { firstFocusableElement.focus(); e.preventDefault(); } } }); } intechno_toggle_icon_burger(); })(jQuery);