WordPress Menuing Question :focus


I’m using the following script in the WordPress functions.php file to disable top level parent items when they have a submenu. It works perfectly, but I need to it actually work like this:

If someone is using a mouse and clicks on the link – go ahead and load the parent link
If someone is using a keyboard and tabbing through – if they enter on the parent link – don’t load it

Right now, it’s blocking the link on the both. Any help would be appreciated.

function jqueryscript_in_head(){ ?>
<script type="text/javascript">
var $j = jQuery.noConflict();
$j(document).ready(function () {
$j("li:has(ul)").children("a").click(function () {
return false;
});  });
<?php }
add_action('wp_head', 'jqueryscript_in_head');
, , Michael Harmon 3 years 2020-03-29T16:53:34-05:00 0 Answers 96 views 0

Leave an answer