Skip to content

Commit 1922bd9

Browse files
committed
Fix: add menu existence check in touchDropdown function
1 parent 680adc3 commit 1922bd9

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
@@ -100,6 +100,13 @@
100100
* @see trac ticket #30575
101101
*/
102102
function touchDropdown() {
103+
var navMenus = $( '.primary-navigation, .secondary-navigation' );
104+
105+
// Check if menus exist before proceeding.
106+
if ( ! navMenus.length ) {
107+
return;
108+
}
109+
103110
if ( 783 > _window.width() ) {
104111
$( '.primary-navigation, .secondary-navigation' ).find( 'a' ).on( 'focus.twentyfourteen blur.twentyfourteen', function() {
105112
$( this ).parents().toggleClass( 'focus' );

0 commit comments

Comments
 (0)