Skip to content

Instantly share code, notes, and snippets.

@dsalvagni
Created May 22, 2014 16:46
Show Gist options
  • Save dsalvagni/ba263fae7ef67185b230 to your computer and use it in GitHub Desktop.
Save dsalvagni/ba263fae7ef67185b230 to your computer and use it in GitHub Desktop.
Lightbox template file for a blog post sample
<?php $style = 'width: '.$this->getData('width').'px; height:'.$this->getData('height').'px; margin:-'.ceil(($this->getData('height')+4)/2).'px 0 0 -'.ceil(($this->getData('width')+4)/2) .'px;'; ?>
<div class="lightbox" id="lightbox" style="<?php echo $style ?> <?php echo ($this->getData('display')=='show') ? ' display:block;' : ' display:none;' ?>" ?>
<a href="<?php echo $this->getData('bannerUrl'); ?>">
<img src="<?php echo $this->getData('imgUrl'); ?>">
</a>
<div class="lightbox-close" onclick="closeLightBox()">X</div>
</div>
<div class="lightbox-shadow" id="lightboxShadow" onclick="closeLightBox()" style="<?php echo ($this->getData('display')=='show') ? ' display:block;' : ' display:none;' ?>"></div>
<script type="text/javascript">
function closeLightBox()
{
document.getElementById('lightboxShadow').style.display='none';
document.getElementById('lightbox').style.display='none';
}
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment