Skip to Content

JavaScript File

URL: https://imam.web.id/wp-content/themes/chromenews/js/navigation.js?ver=20151215
HTTP Status: 200 OK
MIME Type: application/javascript
Last Modified: Sat, 12 Feb 2022 20:18:46 GMT
Download Time: Less than a second
Cookies: None
Size: 3 KB
HTTP Headers:  20 headers
Links In:  1 pages
Links Out:  0 links
Images:  0 images
CSS:  0 files
JavaScript:  0 files
  
OK Issues: No issues found

1/**

2 * File navigation.js.

3 *

4 * Handles toggling the navigation menu for small screens and enables TAB key

5 * navigation support for dropdown menus.

6 */

7( function() {

8 var container, button, menu, links, i, len;

9

10 container = document.getElementById( 'site-navigation' );

11 if ( ! container ) {

12 return;

13 }

14

15 button = container.getElementsByTagName( 'button' )[0];

16 if ( 'undefined' === typeof button ) {

17 return;

18 }

19

20 menu = container.getElementsByTagName( 'ul' )[0];

21

22 // Hide menu toggle button if menu is empty and return early.

23 if ( 'undefined' === typeof menu ) {

24 button.style.display = 'none';

25 return;

26 }

27

28 menu.setAttribute( 'aria-expanded', 'false' );

29 if ( -1 === menu.className.indexOf( 'nav-menu' ) ) {

30 menu.className += ' nav-menu';

31 }

32

33 button.onclick = function() {

34 if ( -1 !== container.className.indexOf( 'toggled' ) ) {

35 container.className = container.className.replace( ' toggled', '' );

36 button.setAttribute( 'aria-expanded', 'false' );

37 menu.setAttribute( 'aria-expanded', 'false' );

38 } else {

39 container.className += ' toggled';

40 button.setAttribute( 'aria-expanded', 'true' );

...

</html>