views:

15

answers:

1

Is there a way to dynamically set the addthis:url attribute after page load?

I am not having any success with this and am curiuos if anyone else has done it.

Specifically, I have a page of images in a gallery that the user scrolls through and I'd like the addthis:url to point to whatever image is currently being viewed. My current (ugly) solution is to load the page with a query that has the image path in it and document.write the share link that way. This works, but I don't want to keep reloading my page and am hoping that there's a way to get the add this link to modify its addthis:url attribute's value on the fly.

A: 

See the tutorial for the general case here (if you haven't already): http://www.addthis.com/help/url-and-title

I'm thinking that if you give each of your addthis anchor tags a specific class attribute value you can run a script on window load that walks through anchor tags of that class and sets their addthis:url attribute to the url of the associated img. My guess is that it's probably easier said than done, but if you're using a library like jQuery it might not be so bad.

Brian Driscoll
no no... I don't have multiple anchor tags. I have one anchor tag that I need to alter as the user moves from image to image... I just got an answer from addthis forums and will post it here, looks like it can be done, just have to test it first.
Dr.Dredel
Ah, my apologies for misunderstanding your question. Glad you seem to have found a solution.
Brian Driscoll
no need for apologies! all help is appreciated. For the moment, the solution that addthis has provided is not working... so... I'm still on the drawing board.
Dr.Dredel