In WordPress, how can you disable the first tap of parent menu, for tablets?

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
simonmlewis
DevNet Master
Posts: 4435
Joined: Wed Oct 08, 2008 3:39 pm
Location: United Kingdom
Contact:

In WordPress, how can you disable the first tap of parent menu, for tablets?

Post by simonmlewis »

We have come across a problem, that is solved on many other websites. Let's say you have a shop website, with Mens, Womens, Housing... and so on.

On Desktop you hover over Mens and up comes the menu. But on Tablet, you tap on Mens and up comes the menu. But in WordPress this doesn't happen. when you Tap Mens it goes to the Mens page.

Is there a simple JS or Functions.php that can be added, so that the 'first tap' simply expands the menu, and a second tap opens the page.

Great examples are these: https://www.johnlewis.com https://www.houseoffraser.co.uk

Both have main menus, and the dropdowns work. and only open their parent pages on the SECOND tap. You might select Mens or Womens, and the dropdown menu appears. When you select Mens again, it goes to the 'Mens' page.

How do you achieve this in WordPress?

I found this possible answer: https://www.tbare.com/2014/04/disable-c ... -children/, but annoyingly, his answer is how to disable it completely, but is it a means to a solution?

I want his "Safari on iOS handles SuperFish pretty well – the first tap drops down the menu, and the second tap will actually take you to that page".....

Can his coding be tweaked so that for these parent menu links, they open the page on 'taps'... on only the second tap?

Can someone please help, so we can add a script that does it perfectly?
Post Reply