1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91
| <link rel='stylesheet' href='css/gallerydisplay.css' type='text/css' media='all'/>
<link rel='stylesheet' href='css/popupgallery.css' type='text/css' media='all'/>
<?php
$sqlart="SELECT * FROM gallery_art WHERE cat_art=2";
$resultatart=mysql_query($sqlart);
echo '<div class="featured">';
while($ligneart=mysql_fetch_assoc($resultatart)){
$linkimg=$ligneart['imgmini_art'];
$linkimglarge=$ligneart['imglarge_art'];
$smalldescription=$ligneart['smalldescription_art'];
$largedescription=$ligneart['description_art'];
$widthart=$ligneart['width_art'];
$i=1;
echo '
<div class="entry">
<a class="poplight" href="#?w='.$widthart.'" rel="popup'.$i.'" ><em></em>
<img src="css/images/minigallery/'.$linkimg.'" alt="" />
<span>'.$smalldescription.'</span>
</a><strong></strong>
</div>
<div id="popup'.$i.'" class="popup_block">
<img src="'.$linkimglarge.'" />
<p>'.$largedescription.'</p>
</div>
';
$i++;
};
?>
</div>
<div class="cl"> </div>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.1/jquery.min.js"></script>
<script type="text/javascript">
$(document).ready(function(){
//When you click on a link with class of poplight and the href starts with a #
$('a.poplight[href^=?page=logo#]').click(function() {
var popID = $(this).attr('rel'); //Get Popup Name
var popURL = $(this).attr('href'); //Get Popup href to define size
//Pull Query & Variables from href URL
var query= popURL.split('?');
var dim= query[1].split('&');
var popWidth = dim[0].split('=')[1]; //Gets the first query string value
//Fade in the Popup and add close button
$('#' + popID).fadeIn().css({ 'width': Number( popWidth ) }).prepend('<a href="#" class="close"><img src="popup_close.png" class="btn_close" title="Close Window" alt="Close" /></a>');
//Define margin for center alignment (vertical + horizontal) - we add 80 to the height/width to accomodate for the padding + border width defined in the css
var popMargTop = ($('#' + popID).height() + 80) / 2;
var popMargLeft = ($('#' + popID).width() + 80) / 2;
//Apply Margin to Popup
$('#' + popID).css({
'margin-top' : -popMargTop,
'margin-left' : -popMargLeft
});
//Fade in Background
$('body').append('<div id="fade"></div>'); //Add the fade layer to bottom of the body tag.
$('#fade').css({'filter' : 'alpha(opacity=80)'}).fadeIn(); //Fade in the fade layer
return false;
});
//Close Popups and Fade Layer
$('a.close, #fade').live('click', function() { //When clicking on the close or fade layer...
$('#fade , .popup_block').fadeOut(function() {
$('#fade, a.close').remove();
}); //fade them both out
return false;
});
});
</script> |