Maximenu mobile and preventDefault

Replied by johnoatwork on topic Maximenu mobile and preventDefault

Posted 8 years 6 months ago #30560
Hi Ced,

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.

Replied by ced1870 on topic Maximenu mobile and preventDefault

Posted 8 years 6 months ago #30562
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

by ced1870

Please Log in or Create an account to join the conversation.

Replied by johnoatwork on topic Maximenu mobile and preventDefault

Posted 8 years 6 months ago #30563
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:

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.680 seconds

Fast and powerful creation, customizable and responsive.

Read More

We have 1315 guests and no members online