Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Sébastien Dumont

    (@sebd86)

    Interesting but no hooking is possible in the JS. However, you could simply ready the hidden “HR” bar that is added per article as the article loads and update the share icons URL’s that way.

    Hope that helps.

    Thread Starter samb_nz

    (@samb_nz)

    Hey Sebastien,

    Thanks for that. I managed to find a way by hooking into the History Adapter method. See below for anyone else trying the same thing.

    The code below will update the addthis with the correct title & URL.

    <script>
    			try {
    			    History.Adapter.bind(window,'statechange',function(){
    			        var title = jQuery('title').text();
    			        addthis.update('share', 'url', window.location.href);
    			        addthis.update('share', 'title', jQuery
    			            ("title").text() );
    			        addthis.ready(); // This will re-render the box.
    			    });
    			}
    			catch(err) {
    			    console.log(err.message);
    			}
    		</script>
    Plugin Author Sébastien Dumont

    (@sebd86)

    Your welcome and thank you for sharing your code.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘JS hook per article load / url change’ is closed to new replies.