tabalinas / jssocials

Social Network Sharing jQuery Plugin
http://js-socials.com
MIT License
464 stars 104 forks source link

Display JSsocials after Ajax form submission #160

Open tergra opened 7 years ago

tergra commented 7 years ago

Hi ! I have an Ajax based form on my website, when a user hits "submit" it displays the content directly without refreshing the page. The problem is it should also display the JSsocials buttons right below the content to enable users to share them, but it doesn't. See by yourself, the second answer doesn't display JSsocials : printscreen

What should I do ? Thank you very very much :)

tabalinas commented 7 years ago

Are you sure you are initializing jsSocials on the element once it's attached to the document?

tergra commented 7 years ago

Well this is the problem, it is not initialized after Ajax displaying content is fired. I guess I should write something like this ?

content.load("http://localhost/simpleecode/ajax/",{id:post_id}, function(){
     /* new html now exists*/
    $(this).find('.classThatNeedsPlugin').somePlugin().slideDown('slow');      

});

If so what should I replace on this line ? $(this).find('.classThatNeedsPlugin').somePlugin().slideDown('slow'); ?

Thanks :)