View Single Post
Old 10-09-2012, 09:53 PM   PM User | #1
arfa
New Coder

 
Join Date: Sep 2006
Posts: 51
Thanks: 1
Thanked 0 Times in 0 Posts
arfa is an unknown quantity at this point
variable transfer from js to PHP

This is somewhat related to jquery but is primarily a .js issue.

I am converting an existing PHP photo album. I have the image load working but can't see how to get the respective caption key from the js to pull from $caption_array.
This is the code I am using - where the div class=change is actually a string of thumbnails each with the ID set as the filename. Click one and the div class=bg-wrapper is loaded with the main image.
Code:
<div class=change>thumb(s)</div>
<script>
$(function() {
$('<img>').attr({'src':'<?php echo $image; ?>','id':'bg','title':''}).appendTo('#bg-wrapper').parent().fadeIn(1000);
    $('.change').click(function(e) { 
    e.preventDefault(); 
    var image = '<?php echo $album; ?>/'+$(this).attr("id").replace("tn_","");
        $('#bg').parent().fadeOut(800, function() {
            $('#bg').attr('src', ''+image); 
              $(this).fadeIn(800); }); }); });
</script>
<div class=bg-wrapper></div>
I hope this is clear.

thanks
arfa is offline   Reply With Quote