81 lines
2.1 KiB
PHP
81 lines
2.1 KiB
PHP
<style>
|
|
#wrapper {
|
|
width:600px;
|
|
margin:0 auto;
|
|
border-radius:0 0 5px 5px;
|
|
-moz-border-radius:0 0 5px 5px;
|
|
-webkit-border-radius: 0 0 5px 5px;
|
|
background:#fff;
|
|
border:1px solid #ccc;
|
|
padding:25px;
|
|
border-top:none;
|
|
box-shadow:0 0 5px #ccc;
|
|
-moz-box-shadow:0 0 5px #ccc;
|
|
-webkit-box-shadow:0 0 5px #ccc;
|
|
text-align:left;
|
|
}
|
|
#lightbox {
|
|
position:fixed; /* keeps the lightbox window in the current viewport */
|
|
top:0;
|
|
left:0;
|
|
width:100%;
|
|
height:100%;
|
|
background:url(/assets/images/overlay.png) repeat;
|
|
text-align:center;
|
|
}
|
|
#lightbox p {
|
|
text-align:right;
|
|
color:#fff;
|
|
margin-right:20px;
|
|
font-size:12px;
|
|
}
|
|
#lightbox img {
|
|
box-shadow:0 0 25px #111;
|
|
-webkit-box-shadow:0 0 25px #111;
|
|
-moz-box-shadow:0 0 25px #111;
|
|
max-width:940px;
|
|
}
|
|
#lightbox_container {
|
|
background:red;
|
|
width:200px;
|
|
position:fixed;
|
|
top:50%;
|
|
left:50%;
|
|
/* bring your own prefixes */
|
|
transform: translate(-50%, -50%);
|
|
border: 1px solid Black;
|
|
}
|
|
</style>
|
|
<script type="text/javascript">
|
|
function show_light_box(id) {
|
|
/*
|
|
If the lightbox window HTML already exists in document,
|
|
change the img src to to match the href of whatever link was clicked
|
|
If the lightbox window HTML doesn't exists, create it and insert it.
|
|
(This will only happen the first time around)
|
|
*/
|
|
if ($('#lightbox').length > 0) { // #lightbox exists
|
|
//place href as img src value
|
|
$('#lightbox_container').html($('#'+id).html());
|
|
//show lightbox window - you could use .show('fast') for a transition
|
|
$('#lightbox').show();
|
|
}
|
|
else { //#lightbox does not exist - create and insert (runs 1st time only)
|
|
//create HTML markup for lightbox window
|
|
var lightbox =
|
|
'<div id="lightbox">' +
|
|
'<p>Click to close</p>' +
|
|
'<div id="lightbox_container">' + //insert clicked link's href into img src
|
|
$('#'+id).html()
|
|
'</div>' +
|
|
'</div>';
|
|
//insert lightbox HTML into page
|
|
$('body').append(lightbox);
|
|
//Click anywhere on the page to get rid of lightbox window
|
|
$('#lightbox').click(function() { //must use live, as the lightbox element is inserted into the DOM
|
|
$('#lightbox').hide();
|
|
});
|
|
}
|
|
}
|
|
</script>
|