Skip to content

Commit ee69503

Browse files
committed
fix: add ability to close sub-menus by clicking outside on touch devices
1 parent 57cfae0 commit ee69503

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/wp-content/themes/twentyfourteen/js/functions.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,13 @@
130130
el.siblings( '.focus' ).removeClass( 'focus' );
131131
}
132132
} );
133+
134+
// Close open sub-menus when clicking outside.
135+
$( document.body ).on( 'touchstart.twentyfourteen', function( e ) {
136+
if ( ! $( e.target ).closest( '.menu-item-has-children, .page_item_has_children' ).length ) {
137+
$( '.focus' ).removeClass( 'focus' );
138+
}
139+
} );
133140
}
134141
}
135142
}

0 commit comments

Comments
 (0)