<?xml version="1.0" encoding="UTF-8"?>
<feed xml:lang="en-gb" xmlns="http://www.w3.org/2005/Atom">
	<title type="text">iaian7 - webcode</title>
	
	<link rel="self" href="https://iaian7.com/atom/?section=webcode" />
	<link rel="alternate" type="text/html" href="https://iaian7.com/" />
	<id>tag:iaian7.com,2005:e37391e5d79adf0edb184bbe25ddbb3b/webcode</id>
	<generator uri="https://textpattern.com/" version="4.8.8">Textpattern</generator>
	<updated>2023-04-28T22:21:43+00:00</updated>
	<author>
		<name>John Einselen</name>
		
		<uri>https://iaian7.com/</uri>
	</author>
	
	<entry>
		<author>
			<name>John Einselen</name>
		</author>
		<published>2018-06-20T15:23:56+00:00</published>
		<updated>2020-07-03T16:18:00+00:00</updated>
		<title type="html">CSS Lightbox Overlay</title>
		<link rel="alternate" type="text/html" href="https://iaian7.com/webcode/CSSLightboxOverlay" />
		<id>tag:iaian7.com,2018-10-20:e37391e5d79adf0edb184bbe25ddbb3b/bef4bfd7a8b3e6c99dca4164a78eecc9</id>
		<category term="css" />
		
		<summary type="html"><![CDATA[<p>Designed as a more modern and much lighter-weight alternative to the antiquated <a href="https://iaian7.com/webcode/mediaboxAdvanced">mediaboxAdvanced</a>. While this relies exclusively on simple <span class="caps">HTML</span> and <span class="caps">CSS</span> for layout and animation, it does require Javascript to allow for automated play and pause when opening or closing video layers, and override default :target behaviour to set states. This stops the browser history from filling up with endless anchor links, but if javascript is disabled, the :target behaviour still works as expected and videos can be manually played or paused as desired (they just won&#8217;t stop playing automatically when the layer is closed).</p>

<script src="https://www.youtube.com/player_api"></script><script src="https://player.vimeo.com/api/player.js"></script>

<script>function lightboxShow(id) {	document.getElementById(id).classList.add('overlay');}function lightboxHide(id) {	document.getElementById(id).classList.remove('overlay');}</script>

<style>/* Removes browser highlight outlines for all links */a {	color: #fff;	text-decoration: none;}a:focus {	outline: none;}/* Makes the link text transparent, but retains content for accessibility */a.thumbnail, a.thumbnail:link, a.thumbnail:active, a.thumbnail:visited, a.thumbnail img {	color: rgba(255, 255, 225, 0);}/* Styles the thumbnail */.thumbnail {	color: rgba(255, 255, 225, 0);	/* positioning and styling of thumbnails */	position: initial;	display: inline-block;	width: 80px;	height: 80px;	background-position: center center;	background-size: cover;	border: 2px solid white;	margin: 16px;	border-radius: 10px;}/* Styles the lightbox elements, removes it from sight and defines animation curves */.lightbox {	position: fixed;	display: block;	top: 0;	bottom: 0;	left: 0;	right: 0;	background: #000;	background: rgba(0, 0, 0, .75);	visibility: hidden;	opacity: 0;	z-index: 999;}.close {	display: block;	position: absolute;	top: 0;	left: 0;	width: 100%;	height: 100%;}.animate {	-webkit-transition: .15s ease-in-out;	-moz-transition: .15s ease-in-out;	-ms-transition: .15s ease-in-out;	-o-transition: .15s ease-in-out;	transition: .15s ease-in-out;}/* Styles the lightbox content, centers it vertically and horizontally, adds the zoom-in transition and makes it responsive using a combination of margin and absolute positioning */.lightbox img {	position: absolute;	display: block;	margin: auto;	top: 0;	left: 0;	right: 0;	bottom: 0;	max-width: 30%;	max-height: 30%;	border: 2px solid white;	/*	box-sizing: border-box;*/}.lightbox iframe {	position: absolute;	display: block;	margin: auto;	top: 0;	left: 0;	right: 0;	bottom: 0;	width: 30vw;	/* 30% of viewport width */	height: 16.875vw;	/* 9/16 * 30 = 16.875 */	max-height: 30vh;	/* 30% of viewport height */	max-width: 53.333333333vh;	/* 16/9 * 90 = 53.333333333 */	border: 2px solid white;	/*	box-sizing: border-box;*/}/* Uses the :target pseudo-class to perform the animations upon clicking the .lightbox anchor */.lightbox:target, .overlay {	visibility: visible;	opacity: 1;}.lightbox:target img, .overlay img {	max-width: 90%;	max-height: 90%;}.lightbox:target iframe, .overlay iframe {	width: 90vw;	/* 90% of viewport width */	height: 50.625vw;	/* (9/16) * 90 = 50.625 */	max-height: 90vh;	/* 90% of viewport height */	max-width: 160vh;	/* (16/9) * 90 = 160 */}</style>

<!-- thumbnail image wrapped in a link --><a class="thumbnail" href="https://iaian7.com/#img1" onclick="lightboxShow('img1'); return false;" style="background-image: url(/media/mediabox/thumbs/nature1.jpg);">image 1</a><a class="thumbnail" href="https://iaian7.com/#img2" onclick="lightboxShow('img2'); return false;" style="background-image: url(/media/mediabox/thumbs/nature2.jpg);">image 2</a><a class="thumbnail" href="https://iaian7.com/#img3" onclick="lightboxShow('img3'); return false;" style="background-image: url(/media/mediabox/thumbs/nature3.jpg);">image 3</a><a class="thumbnail" href="https://iaian7.com/#vid3" onclick="lightboxShow('vid3'); vid3.play(); return false;" style="background-image: url(https://i.vimeocdn.com/video/593475133_600x340.jpg);">Vimeo video</a><!-- lightbox containers hidden with CSS --><a class="lightbox animate" href="https://iaian7.com/#!" onclick="lightboxHide('img1'); return false;" id="img1">	<img class="animate" src="https://iaian7.com/media/mediabox/nature1.jpg" alt="image 1" /><span class="close"></span></a><a class="lightbox animate" href="https://iaian7.com/#!" onclick="lightboxHide('img2'); return false;" id="img2">	<img class="animate" src="https://iaian7.com/media/mediabox/nature2.jpg" alt="image 2" /><span class="close"></span></a><a class="lightbox animate" href="https://iaian7.com/#!" onclick="lightboxHide('img3'); return false;" id="img3">	<img class="animate" src="https://iaian7.com/media/mediabox/nature3.jpg" alt="image 3" /><span class="close"></span></a><div class="lightbox animate" id="vid3">	<a class="close" href="https://iaian7.com/#!" onclick="lightboxHide('vid3'); vid3.pause(); return false;"></a>	<iframe class="animate" src="https://player.vimeo.com/video/183607212" allowfullscreen onload="vid3=new Vimeo.Player(this)"></iframe></div>

<p>YouTube and Vimeo <span class="caps">API</span> scripts are loaded in the header, while the iframes include onload actions to initialise the <span class="caps">API</span>s, and the anchor elements include onclick actions for setting status. This system includes none of the media titles or content detection of <a href="https://iaian7.com/webcode/mediaboxAdvanced">mediaboxAdvanced</a>, and there are some limitations to this mostly-<span class="caps">CSS</span> approach, but in general it&#8217;s pretty usable. Check out the CodePen.io page for more details and the source code.</p>

<a href="https://codepen.io/iaian7/pen/JZqbRw" title="CodePen.io" class="an7_button" onClick="_gaq.push(['_trackEvent', 'files', 'download', 'https://codepen.io/iaian7/pen/JZqbRw']);">1<small>CSS lightbox overlay source</small></a>

<p>You can also check out a demo using next/previous buttons to navigate through groups of overlays. This would require a bit more development to make it useful (especially developing the <span class="caps">CMS</span> integration to make it automatic), but is a starting point for further investigation.</p>

<a href="https://codepen.io/iaian7/pen/KvveLr" title="CodePen.io" class="an7_button" onClick="_gaq.push(['_trackEvent', 'files', 'download', 'https://codepen.io/iaian7/pen/KvveLr']);">1<small>CSS lightbox overlay navigation</small></a>]]></summary>
	</entry>
	<entry>
		<author>
			<name>John Einselen</name>
		</author>
		<published>2018-05-20T14:34:03+00:00</published>
		<updated>2018-10-20T15:16:22+00:00</updated>
		<title type="html">CSS Looping Fader</title>
		<link rel="alternate" type="text/html" href="https://iaian7.com/webcode/CSSLoopingFader" />
		<id>tag:iaian7.com,2018-10-20:e37391e5d79adf0edb184bbe25ddbb3b/1c857feb5a309c4997ed8e889f2c8331</id>
		<category term="css" />
		
		<summary type="html"><![CDATA[<p>This is based on an example by <a href="https://snook.ca/archives/html_and_css/simplest-css-slideshow">Jonathan Snook,</a> but has been updated to fade seamlessly between images without cross fading (which reveals the background). This is achieved by animating the z-index while simultaneously delaying the fade out of each layer until the replacing layer is fully visible.</p>

<style>.box {	display: block;	position: relative;	width: 480px;	height: 200px;}.banner {	display: block;	position: absolute;	width: 480px;	height: 200px;}.img-1, .img-2, .img-3, .img-4 {	display: block;	position: absolute;	top: 0;	width: 480px;	height: 200px;	background-size: cover;	background-repeat: no-repeat;	background-position: center;	z-index: -18;	opacity: 0;	animation-name: fade;	animation-duration: 16s;	animation-iteration-count: infinite;}section .img-1, section .img-2, section .img-3, section .img-4 {	opacity: 1;	animation-name: iris;	animation-duration: 16s;	animation-iteration-count: infinite;}.img-1 { animation-delay: 0s; }.img-2 { animation-delay: 4s; }.img-3 { animation-delay: 8s; }.img-4 { animation-delay: 12s; }@keyframes fade {	00.00%	{ opacity: 0; z-index: -10; }	06.25%	{ opacity: 1; z-index: -10; }	31.25%	{ opacity: 1; z-index: -12; }	37.50%	{ opacity: 0; z-index: -14; }	100.0%	{ opacity: 0; z-index: -16; }}</style><div class="box"><div class="banner">	<div class="img-1" style="background-image: url(https://johneinselen.com/images/277.jpg);"></div>	<div class="img-2" style="background-image: url(https://johneinselen.com/images/261.jpg);"></div>	<div class="img-3" style="background-image: url(https://johneinselen.com/images/81.jpg);"></div>	<div class="img-4" style="background-image: url(https://johneinselen.com/images/149.jpg);"></div></div></div>

	<p>While the animation timeline does depend on a set number of images, it would be possible to set up classes for each variation needed (for example, 4, 5, and 6 image rotations). <code>(fade duration + visible duration)</code> * <code>number of images</code> = <code>total duration</code> which can be used to set up the percentages for the animation timeline. More details can be found in the Jonathan Snook article linked above.</p>

	<p>This version uses <span class="caps">CSS</span> backgrounds (defined in the <span class="caps">HTML</span> by an assumed <span class="caps">CMS</span>) instead of <code>&lt;img&gt;</code> tags to provide a more seamless and responsive (depending on your <span class="caps">CSS</span> setup) end result. Loading images as backgrounds also prevents them from being selected by accident.</p>

	<p><a href="https://codepen.io/iaian7/pen/MEyEoN" title="CodePen.io" class="an7_button" onClick="_gaq.push(['_trackEvent', 'files', 'download', 'https://codepen.io/iaian7/pen/MEyEoN']);">1<small>CSS fader source code</small></a></p>]]></summary>
	</entry>
	<entry>
		<author>
			<name>John Einselen</name>
		</author>
		<published>2009-09-28T17:02:26+00:00</published>
		<updated>2019-12-06T20:26:42+00:00</updated>
		<title type="html">mediaboxAdvanced</title>
		<link rel="alternate" type="text/html" href="https://iaian7.com/webcode/mediaboxAdvanced" />
		<id>tag:iaian7.com,2008-09-22:e37391e5d79adf0edb184bbe25ddbb3b/3b0829bb287fa85f2755f479915a6333</id>
		<category term="javascript" />
		
		<summary type="html"><![CDATA[<p><a href="https://iaian7.com/media/2007/06/2007vfx.flv" rel="lightbox[id240 640 360]" title="MP4 video example::2008 Demo Reel - John Einselen">1</a></p>

	<p>Based on Lightbox, Slimbox, and the Mootools javascript library, <strong>mediaboxAdvanced</strong> is a modal overlay that can handle images, videos, animations, social video sites, twitter media links, inline elements, and external pages with ease.</p>

	<p>This script is no longer being developed, but remains online for reference.</p>]]></summary>
	</entry>
	<entry>
		<author>
			<name>John Einselen</name>
		</author>
		<published>2009-02-18T00:28:43+00:00</published>
		<updated>2011-04-10T20:48:31+00:00</updated>
		<title type="html">Parallax</title>
		<link rel="alternate" type="text/html" href="https://iaian7.com/webcode/Parallax" />
		<id>tag:iaian7.com,2009-02-17:e37391e5d79adf0edb184bbe25ddbb3b/49bb3b4522c3914ef93715d676b1d610</id>
		<category term="javascript" />
		
		<summary type="html"><![CDATA[<p>Parallax is a small javascript based on the Mootools library that allows you to set up 2.5D interaction with basic <span class="caps">DIV</span>s and <span class="caps">CSS</span> styling.  Anywhere from scrollable landscapes to lens flare effects can be achieved, with reasonably easy setup and simple depth controls.</p>]]></summary>
	</entry>
	<entry>
		<author>
			<name>John Einselen</name>
		</author>
		<published>2008-09-27T17:21:32+00:00</published>
		<updated>2019-12-06T20:08:04+00:00</updated>
		<title type="html">Mediabox</title>
		<link rel="alternate" type="text/html" href="https://iaian7.com/webcode/Mediabox" />
		<id>tag:iaian7.com,2007-07-07:e37391e5d79adf0edb184bbe25ddbb3b/f1574008f0cc3459c3c70cdb346e8497</id>
		<category term="javascript" />
		
		<summary type="html"><![CDATA[<p>This script has been replaced by <a href="http://iaian7.com/webcode/mediaboxAdvanced">mediaboxAdvanced</a>.</p>]]></summary>
	</entry>
	<entry>
		<author>
			<name>John Einselen</name>
		</author>
		<published>2007-07-19T00:17:54+00:00</published>
		<updated>2011-04-10T04:43:18+00:00</updated>
		<title type="html">AN7effects</title>
		<link rel="alternate" type="text/html" href="https://iaian7.com/webcode/AN7effects" />
		<id>tag:iaian7.com,2007-07-18:e37391e5d79adf0edb184bbe25ddbb3b/97e32c2bb9e1c4ba1589fb003ec496c0</id>
		<category term="code" />
		<category term="javascript" />
		<summary type="html"><![CDATA[<p>AN7effects is a collection of simple MooTools scripts for adding link effects and content toggles to a website.</p>

	<p>linkFade, contentFade, and contentSlide</p>]]></summary>
	</entry>
</feed>