Still poking about.
I have a FF solution but no IE
Code:
<script>
$(function() {
$('<img>').attr({'src':'<?php echo $image; ?>','id':'bg','title':''}).appendTo('#bg-wrapper').parent().fadeIn(1000);
var captions = [<?php echo $cap_array; ?>];
var len = captions.length;
$('.change').click(function(e) {
e.preventDefault();
var img_now = $(this).attr("id").replace("tn_","");
for (var i=0; i<len; ++i) { var file = captions[i].split("|");
if (file[0]==img_now) { var this_cap = file[1]; }} // works in FF but not IE
//var mytext=document.createTextNode(this_cap);
//document.getElementById("img_caption").appendChild(mytext); // Adds - but not replaces
img_caption.innerHTML = this_cap; // seems OK in FF & IE - but no caption from loop. :(
var image = '<?php echo $album; ?>/'+$(this).attr("id").replace("tn_","");
$('#bg').parent().fadeOut(800, function() {
$('#bg').attr('src', ''+image);
$(this).fadeIn(800); }); }); });
</script>
I suspect this may look a bit clumsy but I am a work in progress...
PS - an alert test on var len has FF=18 IE=17 - which is weird.