Maximenu mobile and preventDefault

More
9 years 5 months ago #30560 by johnoatwork
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.

More
9 years 5 months ago #30562 by ced1870
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.

More
9 years 5 months ago #30563 by johnoatwork
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.198 seconds

Fast and powerful creation, customizable and responsive.

Read More

We have 4145 guests and 2 members online