Hi,
I am using the following code to catch the login link to add Ajax login
$(‘.menu-item’).on(‘click’, function(evt) {
var id = this.id ;
console.log(‘this id_menu=’ + id);
if( id == ‘menu-item-832’) {
evt.preventDefault();
$(“#top_search”).hide();
$(‘form#login’).fadeIn(500);
}
});
This works on the normal menu but fails on the mobile menu. I can’t seem to find a way to identify which menu item was clicked on the mobile menu.
What am I missing?
Thanks
Hey geomat1,
To access the mobile menu items using jQuery please declare a variable first then try to read the variable when the document is loaded.
var menuItem = jQuery('li.menu-item');
jQuery(document).on('click', '.menuItem', function () {
//--- YOUR CODE HERE ---//
}
Best regards,
Vinay
Hi Vinay,
Thanks works now, but I had to change the jQuery as follows to make it work.
From: jQuery(document).on(‘click’, ‘.menuItem’, function () {
To: jQuery(document).on(‘click’, ‘.menu-item’, function () {
Just in case anyone else has the same problem.
Thanks again.
Hi,
Glad we could help!
Please take a moment to review our theme on themeforest https://themeforest.net/downloads
To know more about enfold features please check – http://kriesi.at/documentation/enfold/
Thank you for using Enfold :)
Best regards,
Vinay