dk4210
03-09-2012, 12:33 PM
Hello Guys,
I have a page with thumb nails and a large image that changes when clicking on thumbnail. I need to display dynamic title for the image. It wont display because the page is not reloading.. How do you pass the name so it will show up without reloading?
Here is the JS for switching dynamically loading the large image
<script language="javascript">
$(document).ready(function() {
$('.thumbnail').live("click", function() {
$('#mainImage').hide();
$('#atitle').hide();
$('#imageWrap').css('background-image', "url('/images/ajax-loader.gif')");
var i = $('<img />').attr('src',this.href).load(function() {
$('#mainImage').attr('src', i.attr('src'));
$('#imageWrap').css('background-image', 'none');
$('#mainImage').fadeIn();
$('#atitle').fadeIn();
});
return false;
});
});
</script>
Here is the link for the thumb
// Thumbnail Display
echo '<a href="artists/'.$artist.'/'.$imgname.'.jpg" class="thumbnail"><img src="artists/'.$artist.'/previews/'.$imgname.'.jpg" border="0" /></a>';
[/PHP]
Link to the large image
// Large image display
echo '<img src="artists/'.$artist.'/'.$first_image.'.jpg" alt="Main Image" id="mainImage"/>';
Here is the php echo for the title
<? echo str_replace('"', '`', $iname); ?>
I need to some how pass a php var from the thumb link to the js and have it display dynamically(without reloading)
Hope I explained this correctly.. Please advise..
Thanks, Dan
I have a page with thumb nails and a large image that changes when clicking on thumbnail. I need to display dynamic title for the image. It wont display because the page is not reloading.. How do you pass the name so it will show up without reloading?
Here is the JS for switching dynamically loading the large image
<script language="javascript">
$(document).ready(function() {
$('.thumbnail').live("click", function() {
$('#mainImage').hide();
$('#atitle').hide();
$('#imageWrap').css('background-image', "url('/images/ajax-loader.gif')");
var i = $('<img />').attr('src',this.href).load(function() {
$('#mainImage').attr('src', i.attr('src'));
$('#imageWrap').css('background-image', 'none');
$('#mainImage').fadeIn();
$('#atitle').fadeIn();
});
return false;
});
});
</script>
Here is the link for the thumb
// Thumbnail Display
echo '<a href="artists/'.$artist.'/'.$imgname.'.jpg" class="thumbnail"><img src="artists/'.$artist.'/previews/'.$imgname.'.jpg" border="0" /></a>';
[/PHP]
Link to the large image
// Large image display
echo '<img src="artists/'.$artist.'/'.$first_image.'.jpg" alt="Main Image" id="mainImage"/>';
Here is the php echo for the title
<? echo str_replace('"', '`', $iname); ?>
I need to some how pass a php var from the thumb link to the js and have it display dynamically(without reloading)
Hope I explained this correctly.. Please advise..
Thanks, Dan