Menu icon Foundation
Stop Foundation intercepting click/touch events

I'm using the Reverie theme for WordPress, and it incorporates foundation. My issue is that im using a plugin called Ubermenu to generate/display my navigation. Foundation is intercepting all the click and touch events which is stopping the menu working on mobile devices.

I first thought it was fastclick, but after removing all of its functions i still have the issue. It's tough to decipher anything since the JS file is minified.

I was wondering if you could help with what code i need to remove.

Thanks.

touch. clickeventsmenudisable

I'm using the Reverie theme for WordPress, and it incorporates foundation. My issue is that im using a plugin called Ubermenu to generate/display my navigation. Foundation is intercepting all the click and touch events which is stopping the menu working on mobile devices.

I first thought it was fastclick, but after removing all of its functions i still have the issue. It's tough to decipher anything since the JS file is minified.

I was wondering if you could help with what code i need to remove.

Thanks.

Lynda Spangler almost 5 years ago

I am unsure how to help you as I would first think of Fastclick but you already removed it. A tool which may help you is JS Beautify : http://jsbeautifier.org/ - You can unminify code using that tool and it may help you decipher the code.

James Ralph almost 5 years ago

Thank you for the reply. I used that tool on the foundation.min file, but i'm not really JavaScript savy, so not sure what to look for.

I searched for Fastclick and it only has one instance:

 a(function () {
        "undefined" != typeof FastClick && "undefined" != typeof c.body && FastClick.attach(c.body)
    });

I don't really know what that does. Or if something else in the foundation.min is causing the issue.

Lynda Spangler almost 5 years ago

I wish I could help you more but I am not a JS expert either.

Wing-Hou Chan almost 5 years ago

Hey James!

Could you post a link to the site in development?

If you removed FastClick and the menu is still not working I wouldn't think it was FastClick that was causing the problem.

Could you also detail the steps in how you concluded it was FastClick that was causing the problem? It'll help make sure if it is FastClick that is causing the problem and stop others helping covering the same tracks again and again.

James Ralph almost 5 years ago

Using http://jsbeautifier.org/ does not work, i cannot recover minified variable names. I would need a unminified version of the file.

The site is www.emma-uk.com

I do not conclude that it is fastclick, but i know it is something inside of Foundation. Fastlick is just my best idea at this time.

I think Foundation is included in my theme using Bower Components. I found a Fastclick folder inside the bower_components folder, which i removed. I then also found a fastlick.js file inside the foundation folder inside the bower_components folder.

I deactivated all plugins on the site apart from Ubermenu, then added this code to my functions.php file:

function remove_foundation_js(){
    echo 'remove';
    wp_dequeue_script( 'reverie-js' );
}
add_action( 'wp_footer' , 'remove_foundation_js' , 1 );

Then commented out this in my footer.php:

 (function($) {

    //$(document).foundation();

})(jQuery);

The Ubermenu navigation then works perfectly on mobile devices.

But this is not practical fix as my theme requires Foundation to work.

Wing-Hou Chan almost 5 years ago

Hey James!

Sorry for the wait!

Have you fixed the problem? I took a look at the site and the menu appears to be working.