dynamically changing text according to the alt attribute?
hi
i have a gallery.
When someone clicks on a thumbnail the main images changes.
However, i also want the text to change.
The gallery uses the href attribute to change the image. At the moment i am using the alt attribute of the thumb to replace the visible text on the page.
So.. you click on the thumb and the text on the main page is replaced with the alternative text. i.e
html
-
<a href="images/photos/mirrors/pinch/11_squr.jpg" title="Image 1">
<img src="images/photos/mirrors/thumbs/pinch/8.jpg" class="pinch" alt="this text replaces the text aleady there"/></a>
jquery code
-
$('.dynamic-text').fadeTo( 1, 0.0 ).text("" + $('.pinch').attr("alt") + "").fadeTo( 1500, 1.0 );
So far so good. When i click on the thumb the text changes. However, it only seems to change once. can anyone see why this might be?
Additionally, i cannot add any line breaks etc into the alt attribute. Can anyone think of a better alternative to using the alt attribute to acheive the same effect?
I dont want to use ajax due to the negative seo implications.
Any sugguestion would be greatly appreciated.
Thanks.