<?xml version="1.0" encoding="utf-8"?><rss version="2.0"><channel><title>Pixelation</title><link>http://cascadepixels.com.au:80/pixelation</link><description>Some attempts to make sense of it all while flying around the cosmos on a small blue-green dot in the outer reaches of a pretty average galaxy somewhere in the universe.</description><item><title>Lazy Loading Images in Orchard</title><link>http://cascadepixels.com.au:80/pixelation/lazy-loading-images-in-orchard</link><description>&lt;p&gt;One thing I've been meaning to do forever is implement lazy loading for images. After all, if an image is below the fold, and the user never scrolls down the page, why waste bits downloading it?&lt;/p&gt;
&lt;p&gt;While I was at it I also implemented a simple fade-in animation.&amp;nbsp;&lt;/p&gt;
&lt;h2&gt;Requirements&lt;/h2&gt;
&lt;p&gt;This article assumes you're using Orchard 1.9 with the &lt;strong&gt;hiphouse&lt;/strong&gt; swatch of the &lt;strong&gt;Cascade.Bootstrap&lt;/strong&gt; theme, but the principles are simple and you can adapt it to pretty much any web page.&lt;/p&gt;
&lt;h2&gt;How It Works&lt;/h2&gt;
&lt;p&gt;Lazy loading is accomplished by a small amount of Javascript (shown below). As soon as document ready fires all images with a class of &lt;code&gt;reveal&lt;/code&gt; are stipped of their &lt;code&gt;src&lt;/code&gt; attribute, preventing them from displaying. The src url is saved to an attribute called &lt;code&gt;data-src&lt;/code&gt; so the image can be loaded correctly at the appropriate time.&lt;/p&gt;
&lt;p&gt;The second phase is triggered by a &lt;code&gt;load, resize&lt;/code&gt; or &lt;code&gt;scroll&lt;/code&gt; event. In response to one of these events, including the initial &lt;code&gt;load&lt;/code&gt; event, all images that have not yet been revealed and have a&amp;nbsp;&lt;code&gt;data-src&lt;/code&gt; attribute are tested to see if any part of the image is visible in the browser viewport. An image that is visible has a load event handler called &lt;code&gt;fadeInImage&lt;/code&gt; added to it that fades in the image by swapping the &lt;code&gt;reveal&lt;/code&gt; class for a &lt;code&gt;reveal-fade-in&lt;/code&gt; class. The &lt;code&gt;reveal&lt;/code&gt; class simply hides the image by making it transparent, and &lt;code&gt;reveal-fade-in&lt;/code&gt; animates an image fade-in.&lt;/p&gt;
&lt;h2&gt;How to Set an Image to be Lazy Loaded&lt;/h2&gt;
&lt;p&gt;So how do you set up an image so that it is lazy-loaded? Simply add the class reveal to it.&lt;/p&gt;
&lt;h2&gt;Javascript&lt;/h2&gt;
&lt;p&gt;Since jQuery is loaded for other reasons, the code takes advantage of it.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Here's the JS you'll need to include. If you're using the hiphouse swatch from Cascade.Bootstrap then it's already included in the &lt;code&gt;custom.js&lt;/code&gt; file.&lt;/p&gt;
&lt;pre&gt;
$(document).ready(function () {

	// Immediately remove the src attribute from all images to be 'revealed'
	// if an image has already started loading it will be cancelled
	$('img.reveal').each(function () {
		var t = $(this);
		t.attr('data-src', t.attr('src'));
		t.removeAttr('src');
	});

	var fadeInImage = function (e) {
		e.stopPropagation();
		e.data.removeClass('reveal').addClass('reveal-fade-in');
	}

	// load and reveal images when they appear in the viewport
	var loadImage = function () {
		$('img[data-src].reveal').each(function () {
			if (isElementInViewport(this)) {
				var t = $(this);
				
				// fade-in the image after it has loaded
				t.one('load', t, fadeInImage);

				// load the image
				t.attr('src', t.attr('data-src')); 
				t.removeAttr('data-src'); // only process this image once
			}
		});
	}

	function isElementInViewport(el) {

		var rect = el.getBoundingClientRect();

		return (rect.right &amp;gt;= 0
			&amp;amp;&amp;amp; rect.bottom &amp;gt;= 0
			&amp;amp;&amp;amp; rect.left &amp;lt;= (window.innerWidth || document.documentElement.clientWidth)
			&amp;amp;&amp;amp; rect.top &amp;lt;= (window.innerHeight || document.documentElement.clientHeight));
	}

	$(window).on('load resize scroll', loadImage);

});
&lt;/pre&gt;
&lt;h2&gt;CSS&lt;/h2&gt;
&lt;p&gt;There are only two classes you need to support fade-in. These are already included in the &lt;strong&gt;hiphouse&lt;/strong&gt; swatch in&amp;nbsp;the &lt;strong&gt;Cascade.Bootstrap&lt;/strong&gt; theme.&lt;/p&gt;
&lt;pre&gt;.reveal-fade-in {
    opacity: 1;
    -moz-transition: opacity linear 1s;
    -o-transition: opacity linear 1s;
    -webkit-transition: opacity linear 1s;
    transition: opacity linear 1s;
}

.reveal {
    opacity: 0;
}

&lt;/pre&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;</description><pubDate>Wed, 24 Jun 2015 01:01:00 GMT</pubDate><guid isPermaLink="true">http://cascadepixels.com.au:80/pixelation/lazy-loading-images-in-orchard</guid></item><item><title>How to Create a Full Screen Background Image</title><link>http://cascadepixels.com.au:80/pixelation/how-to-create-a-full-screen-background-image</link><description>&lt;p&gt;This article assumes&amp;nbsp;that you are using Layouts in Orchard 1.9, together with Cascade.Bootstrap and the hiphouse swatch. If you don't have this theme then you need to load the LESS&amp;nbsp;listed at the bottom&amp;nbsp;of the&amp;nbsp;page.&lt;/p&gt;
&lt;p&gt;A good way to grab the attention of visitors is with a big, bold image, and a short, succinct message. Many website use this technique and I've wanted to implement it for Orchard using Bootstrap for some time. Here's an example:&lt;/p&gt;
&lt;p&gt;&lt;img class="cascade-reveal" src="../../../../../Media/CascadePixels/Full%20Screen%20Background%20Blog/example.png" alt="" width="558" height="358" /&gt;&lt;/p&gt;
&lt;p&gt;No matter how big the browser viewport, the initial image fills the window and the message in displayed centered on top of it (for small devices this is not quite true, as we try to make better use of screen realestate on devices that are usually vertical instead of horizontal). This blog is about how to create such a page.&lt;/p&gt;
&lt;h2&gt;Create a new Page&lt;/h2&gt;
&lt;p&gt;It doesn't have to be a page: any layout will do. You can even create&amp;nbsp;it in a Widget.&lt;/p&gt;
&lt;p&gt;&lt;img class="cascade-reveal" src="../../../../../Media/CascadePixels/Full%20Screen%20Background%20Blog/new-page.png" alt="" width="606" height="409" /&gt;&lt;/p&gt;
&lt;h2&gt;Add a Canvas Element&lt;/h2&gt;
&lt;p&gt;Drag a Canvas Element from the toolbar and drop it inside the existing canvas, so you end up with a canvas inside a canvas. This setup allows you to add further content below the fold that will be created by the second canvas.&lt;/p&gt;
&lt;p&gt;Edit the nested&amp;nbsp;Canvas element and give it a class of&amp;nbsp;&lt;strong&gt;hip-head&lt;/strong&gt;:&lt;/p&gt;
&lt;p&gt;&lt;img class="cascade-reveal" src="../../../../../Media/CascadePixels/Full%20Screen%20Background%20Blog/hip-head.png" alt="" width="605" height="409" /&gt;&lt;/p&gt;
&lt;p&gt;Adding the hip-head class to this canvas will cause it to fill the screen. Anything you place within this canvas will be displayed on top of it.&lt;/p&gt;
&lt;h2&gt;Add a Grid Element&lt;/h2&gt;
&lt;p&gt;Drag a Grid element from the toolbar and drop it onto the Canvas. Give is a class of &lt;strong&gt;hip-text&lt;/strong&gt;:&lt;/p&gt;
&lt;p&gt;&lt;img class="cascade-reveal" src="../../../../../Media/CascadePixels/Full%20Screen%20Background%20Blog/hip-text.png" alt="" width="606" height="409" /&gt;&lt;/p&gt;
&lt;p&gt;The hip-text class vertically centers the content within the initial screen.&lt;/p&gt;
&lt;h2&gt;Add Rows and Columns&lt;/h2&gt;
&lt;p&gt;Drag a 3-column Row from the toolbar and drop it onto the Grid:&lt;/p&gt;
&lt;p&gt;&lt;img class="cascade-reveal" src="../../../../../Media/CascadePixels/Full%20Screen%20Background%20Blog/row.png" alt="" width="606" height="409" /&gt;&lt;/p&gt;
&lt;h2&gt;Set Center Column Properties&lt;/h2&gt;
&lt;p&gt;Edit the properties of the center column to give it a class of &lt;strong&gt;hip-panel&lt;/strong&gt; and a background-color:&lt;/p&gt;
&lt;p&gt;&lt;img class="cascade-reveal" src="../../../../../Media/CascadePixels/Full%20Screen%20Background%20Blog/column.png" alt="" width="606" height="409" /&gt;&lt;/p&gt;
&lt;h2&gt;Add an HTML Element&lt;/h2&gt;
&lt;p&gt;Drag an HTML element from the toolbar and drop it on the center column. Put some text in the HTML element:&lt;/p&gt;
&lt;p&gt;&lt;img class="cascade-reveal" src="../../../../../Media/CascadePixels/Full%20Screen%20Background%20Blog/html.png" alt="" width="606" height="409" /&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;h2&gt;Variations&lt;/h2&gt;
&lt;p&gt;This is just an outline of how to set up the basics. You may want to take advantage of the following ideas.&lt;/p&gt;
&lt;h3&gt;Background Image&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;A background image is set in the CSS. This is easily overridden by setting a Style property on the top-level canvas element:&lt;/li&gt;
&lt;/ul&gt;
&lt;p style="padding-left: 60px;"&gt;background: #ff0000 url('/media/default/test/dsc_6451_1.jpg?width=2560&amp;amp;quality=60') no-repeat bottom center scroll;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;You might also like to experiment with different image settings, such as fixed instead of scroll, and setting repeat-x, repeat-y or repeat.&lt;/li&gt;
&lt;li&gt;The url above includes a querystring for ImageResizer. This is optional, but very handy if you want to change image properties. I have found that setting a large image with relatively low quality is a good compromise. If you set the quality too high you'll get a magnificent image on large desktops but it will be unusably slow on a broadband phone. Remember that the same image is going to get downloaded no matter what size the screen is.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;Rows and Columns&lt;/h3&gt;
&lt;p&gt;I use a 3-Column Row to center the text box horizontally. You can vary this any way you like:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Ditch the Row altogether and place an HTML Element directly. You will need to use CSS&amp;nbsp;to set the position.&amp;nbsp;If you do this, add the hip-panel class to the HTML Element to get some padding.&lt;/li&gt;
&lt;li&gt;Adjust the size of the left and right columns to make the center column wider or narrower.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;HTML Element&lt;/h3&gt;
&lt;p&gt;You can do anything you want in the HTML Element:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Use text-align to move the text about.&lt;/li&gt;
&lt;li&gt;Format the text how you like it.&lt;/li&gt;
&lt;li&gt;Set color background (including gradients). I find that setting an opacity around .5 looks good. Use the CSS rgba() function for this.&lt;/li&gt;
&lt;li&gt;Set borders and padding to suit.&lt;/li&gt;
&lt;li&gt;Add icons, logos, images, links, etc.&lt;/li&gt;
&lt;li&gt;Replace the HTML Element with a Grid or Rows and Columns and go to town.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;&amp;nbsp;LESS File&lt;/h2&gt;
&lt;p&gt;Here's the less file I used:&lt;/p&gt;
&lt;pre&gt;.hip-head&amp;nbsp;{&lt;br /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;//&amp;nbsp;This&amp;nbsp;is&amp;nbsp;the&amp;nbsp;small-device&amp;nbsp;styling&lt;br /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;background:&amp;nbsp;url('/media/default/test/dsc_6451_1.jpg?width=2560&amp;amp;quality=60')&amp;nbsp;no-repeat&amp;nbsp;bottom&amp;nbsp;center&amp;nbsp;scroll;&lt;br /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;background-color:&amp;nbsp;rgb(128,&amp;nbsp;128,&amp;nbsp;128);&lt;br /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;background-size:&amp;nbsp;cover;&lt;br /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;height:&amp;nbsp;auto;&lt;br /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;width:&amp;nbsp;100%;&lt;br /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;display:&amp;nbsp;table;&lt;br /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;padding:&amp;nbsp;100px&amp;nbsp;0;&lt;br /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;.hip-text&amp;nbsp;{&lt;br /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;display:&amp;nbsp;table-cell;&lt;br /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;vertical-align:&amp;nbsp;middle;&lt;br /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;.hip-panel&amp;nbsp;{&lt;br /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;padding:&amp;nbsp;15px;&lt;br /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;h2&amp;nbsp;{&lt;br /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;font-size:&amp;nbsp;30px;&lt;br /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;color:&amp;nbsp;#fff;&lt;br /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;br /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;h1&amp;nbsp;{&lt;br /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;font-size:&amp;nbsp;36px;&lt;br /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;color:&amp;nbsp;#fff;&lt;br /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;br /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;br /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;br /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;//&amp;nbsp;Override&amp;nbsp;the&amp;nbsp;small-device&amp;nbsp;styling&amp;nbsp;for&amp;nbsp;desktop&lt;br /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;@media&amp;nbsp;(min-width:768px)&amp;nbsp;{&lt;br /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;height:&amp;nbsp;100vh;&amp;nbsp;//&amp;nbsp;NOTE:&amp;nbsp;vh&amp;nbsp;units&amp;nbsp;here:&amp;nbsp;100vh=100%&amp;nbsp;of&amp;nbsp;vertical&amp;nbsp;height&amp;nbsp;of&amp;nbsp;screen&lt;br /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;padding:&amp;nbsp;0; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;br /&gt;    } &lt;br /&gt;} &lt;br /&gt;&lt;br /&gt;&lt;/pre&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;</description><pubDate>Tue, 23 Jun 2015 03:46:00 GMT</pubDate><guid isPermaLink="true">http://cascadepixels.com.au:80/pixelation/how-to-create-a-full-screen-background-image</guid></item><item><title>Fridge Henge</title><link>http://cascadepixels.com.au:80/pixelation/fridge-henge</link><description>&lt;p&gt;The year is 2114 and a discovery has been made (click the image for more) ...&lt;/p&gt;
&lt;p&gt;&lt;a href="../fridge-henge"&gt;&lt;img class="cascade-reveal" src='../../../../../Media/CascadePixels/FridgeHenge/DSC_7419-Edit.jpg?height=246&amp;width=622&amp;quality=80' alt="" width="622" height="246" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h3&gt;&lt;a href="../fridge-henge"&gt;Fridge Henge&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;Conceived by Ben Laycock and built by Dean Bridgehfoot with the help of Keenen Sutherland, Johnno Smith, Jason Hendrickson and many others, this installation is part of the&amp;nbsp;&lt;a href="http://www.castlemainefestival.com.au/"&gt;Castlemaine State Festival&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;But PROGRESS is unstoppable and lower forms of humans have found it necessary to add their grunts and groans to this story. But its not exactly hard to tell the narratives apart, and the additional 'text' makes the central message somehow more stark and important.&lt;/p&gt;
&lt;p&gt;My first glance (above) was not very&amp;nbsp;promising, but a trusted friend had recommended it so I approached, and am very glad I did. There's a lot going on here and in the photos I have concentrated on the printed messages only. I suggest you visit it to discover the rest yourself.&lt;/p&gt;
&lt;p&gt;You'll find it on the Midland Highway going north out&amp;nbsp;of Castlemaine, opposite the new fire station.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;</description><pubDate>Mon, 23 Mar 2015 03:24:00 GMT</pubDate><guid isPermaLink="true">http://cascadepixels.com.au:80/pixelation/fridge-henge</guid></item></channel></rss>