Maximenu mobile and preventDefault
- johnoatwork
- Topic Author
- Offline
- New Member
-
Less
More
- Posts: 19
- Thank you received: 0
9 years 5 months ago #30560
by johnoatwork
Replied by johnoatwork on topic Maximenu mobile and preventDefault
Hi Ced,
Good thinking! The following code adds the classes back:
The resulting html in the mobile menu is this:
The only issue is it doesn't fire AddThis.
The same html in a custom html module anywhere on the page works, it just doesn't work when called from mobile menu.
Any thoughts on why this might be?
Regards
John
Good thinking! The following code adds the classes back:
Code:
setInterval(function(){
if(jQuery("#toolsmenu_ck-mobilebarmaximenuck").is(":visible"))
{
jQuery("div.maximenuck.item174.level1 a").addClass("addthis_toolbox custom_images addthis_button_more");
}
}, 3000);
The resulting html in the mobile menu is this:
Code:
<a href="#" class="addthis_toolbox custom_images addthis_button_more" title=""><span class="mobiletextck"> Share</span></a>
The only issue is it doesn't fire AddThis.
The same html in a custom html module anywhere on the page works, it just doesn't work when called from mobile menu.
Any thoughts on why this might be?
Regards
John
Please Log in or Create an account to join the conversation.
9 years 5 months ago #30562
by ced1870
Joomlack Webmaster and Developer
Replied by ced1870 on topic Maximenu mobile and preventDefault
I don't know why your addthis is not loaded. I just think that you shall launch a clearInterval once done to break the timer, else it loop infinite
Joomlack Webmaster and Developer
Please Log in or Create an account to join the conversation.
- johnoatwork
- Topic Author
- Offline
- New Member
-
Less
More
- Posts: 19
- Thank you received: 0
9 years 5 months ago #30563
by johnoatwork
Replied by johnoatwork on topic Maximenu mobile and preventDefault
Well, I figured it out. It seems that since the class is added dynamically you have to re-register the event handler. You can't do this in the normal way but you can use the API like this after adding the classes back in:
Works now
Thanks for your input.
Cheers
John
Code:
addthis.button(".custom_images");
Works now

Thanks for your input.
Cheers
John
Please Log in or Create an account to join the conversation.
Time to create page: 0.198 seconds