2

I have a small photo gallery that is displaying images from the database however once the image is loaded it is suppose to be displaying on the right side of the gallery frame. but in this case it does not display i am using JQuery to construct the Gallery can anyone help me solve this problem.

$(document).ready(function () {

    $(".galleryThumbnail a").click(function (e) {
        e.preventDefault();

        //update thumbnail
        $(".galleryThumbnail a").removeClass("selected");
        $(".galleryThumbnail a").children().css("opacity", "1");

        $(this).addClass("selected");
        $(this).children().css("opacity", ".4");

        //setup thumbnails
        var photoCaption = $(this).attr('title');
        var photofullsize = $(this).attr('href');

        $(".galleryPreview").fadeOut(500, function () {

            $(".gallery_preload_area").html("")
            // this is what is going to happen after the fadeout
            $(".galleryPreview").html("<a  href='" + photofullsize + "' style=' background-image:url(" + photofullsize + ");'></a>");
            $(".galleryCaption").html("<p><a href='" + photofullsize + "' title='Click to view large'>View Large</a></p><p></p>")
            $(".galleryPreview").fadeIn(500);

        });
    });
});

it is being displayed on the page like this

<?php
$query     = "SELECT * FROM image WHERE hotel_id = {$hotel['hotel_id']}";
$image_set = mysql_query($query, $connection);
while ($image = mysql_fetch_array($image_set)) {
?>                                                        
    <a href=\"img/photos/<?php   echo $image['image_url']; ?>" 
    title="<?php   echo $image['image_url'];    ?>">
    <img src="img/photos/<?php  echo $image['image_url'];  ?>" width="75" height="75"/>
    </a>           
<?php
}
?> 

to see the page in action please visit this site: http://clicktravelnstay.com/desti_list.php?details=19

1 Answer 1

1

try this jquery

output

enter image description here

$(document).ready(function(){

$(".galleryThumbnail a").click(function(e){
     e.preventDefault();

     //update thumbnail
     $(".galleryThumbnail a").removeClass("selected");
     $(".galleryThumbnail a").children().css("opacity","1");

     $(this).addClass("selected");
     $(this).children().css("opacity",".4");

     //setup thumbnails
     var photoCaption = $(this).attr('title');
     var photofullsize =$(this).attr('href');

     alert(photofullsize+photoCaption);
     var fullpath = photofullsize+photoCaption;
         $(".galleryPreview").fadeOut(500, function(){ 

         $(".gallery_preload_area").html("")  
           // this is what is going to happen after the fadeout
           $(".galleryPreview").html("<a  href='"+ photofullsize +"' style='background-image:url("+fullpath+");'></a>");
           $(".galleryCaption").html("<p><a href='"+photofullsize+"' title='Click to view large'>View Large</a></p><p></p>")    
           $(".galleryPreview").fadeIn(500);

          });


});



});



$query = "SELECT * FROM image WHERE hotel_id = {$hotel['hotel_id']}";

$image_set =  mysql_query($query,$connection);

while($image = mysql_fetch_array($image_set)){?>

<a href="img/photos/<?php echo $image['image_url'];?>" title="<?php echo $image['image_url']?>">
<img src="img/photos/<?php echo $image['image_url'];?>" width="75" height="75"/></a>    

<?php } ?>

Please let me know if not working

Sign up to request clarification or add additional context in comments.

2 Comments

i have improve my answer please take a look
I got that problem sorted it was just a matter of the path of the image however my problem now is that i would like it to resize automaticly no matter how big the image is it should be able to full display on the right. thanks again for you support

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.