<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	xmlns:series="http://unfoldingneurons.com/"
	>

<channel>
	<title>Ovalpixels Blog about Web-Building &#187; html</title>
	<atom:link href="http://www.ovalpixels.com/blog/tag/html/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.ovalpixels.com/blog</link>
	<description>Tips &#38; Tricks on Web Design and Development</description>
	<lastBuildDate>Fri, 28 Jan 2011 09:17:42 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Making fancy websites without Flash 2: Animating background image</title>
		<link>http://www.ovalpixels.com/blog/2009/02/21/making-fancy-websites-without-flash-animating-background-image/</link>
		<comments>http://www.ovalpixels.com/blog/2009/02/21/making-fancy-websites-without-flash-animating-background-image/#comments</comments>
		<pubDate>Sat, 21 Feb 2009 18:48:43 +0000</pubDate>
		<dc:creator>georgi</dc:creator>
				<category><![CDATA[Design]]></category>
		<category><![CDATA[Development]]></category>
		<category><![CDATA[animation]]></category>
		<category><![CDATA[html]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[jQuery]]></category>

		<guid isPermaLink="false">http://www.ovalpixels.com/blog/?p=87</guid>
		<description><![CDATA[This is a continuation of the Making fancy website without Flash entry from a few days ago. To make the story short &#8211; I will try and show you some jQuery alernatives for popular Flash animation. We will start with a Smooth background image swap &#8211; jQuery Background-Image Transition Plugin I will show you an [...]]]></description>
			<content:encoded><![CDATA[<p>This is a continuation of the <a  href="http://www.ovalpixels.com/blog/2009/02/20/making-fancy-websites-without-flash-introduction/" target="_blank">Making fancy website without Flash</a> entry from a few days ago. To make the story short &#8211; I will try and show you some jQuery alernatives for popular Flash animation. <span id="more-87"></span>We will start with a</p>
<h3>Smooth background image swap &#8211; jQuery Background-Image Transition Plugin</h3>
<p>I will show you an example right now, so you know what I am talking about.</p>
<p><a  title="background-image-transition-example" href="http://www.ovalpixels.com/bgImageTransition/">Here is a working example</a></p>
<p>What we basically do is:</p>
<ol>
<li>Create an additional hidden &lt;div&gt; element on top ( using z-index ) of the element we want to animate</li>
<li>Load the new image in the in the cache in the background, so that the effect is smooth</li>
<li>Set the new src to the new &lt;div&gt; element</li>
<li>fadeIn() the new &lt;div&gt; element so that it creates the illusion that the background image of our initial div is smoothly changing</li>
<li>Optional step &#8211; if we need to change the image once again, go from 2 to 5 but setting the new src to our <em>initial </em>&lt;div&gt; and then using <em>fadeOut()</em> on the new element, so that it disappears and the new image is set as background to the old &lt;div&gt;. This way we won&#8217;t have an infinitive increase of the z-index and won&#8217;t actually change the z-index of the initial &lt;div&gt;</li>
</ol>
<p>OK, let&#8217;s get to work, we will start with the HTML markup:</p>
<p>&lt;div id=&#8221;backImage&#8221;&gt;&lt;/div&gt;</p>
<p>Well, that was pretty easy: we have a simple &lt;div&gt; element with some demo text and just next to it we add that additional &lt;div&gt; which we will need for the animation.</p>
<p>So, here is the CSS:</p>

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;"><span style="color: #cc00cc;">#backImage</span> <span style="color: #00AA00;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">z-index</span><span style="color: #00AA00;">:</span> -<span style="color: #cc66cc;">2</span><span style="color: #00AA00;">;</span>
    <span style="color: #000000; font-weight: bold;">height</span><span style="color: #00AA00;">:</span><span style="color: #933;">600px</span><span style="color: #00AA00;">;</span>
    <span style="color: #000000; font-weight: bold;">width</span><span style="color: #00AA00;">:</span><span style="color: #933;">800px</span><span style="color: #00AA00;">;</span>
    <span style="color: #000000; font-weight: bold;">background-image</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">url</span><span style="color: #00AA00;">&#40;</span><span style="color: #ff0000;">'path/to/initial/img'</span><span style="color: #00AA00;">&#41;</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span></pre></div></div>

<p>We just set a height and width of the element so that we are sure the image will actually be shown. It is generally a good idea to have the z-index set to a negative number while other elements have a greater z-index value.</p>
<p>We will use <a  href="http://plugins.jquery.com/project/bgImageTransition/" target="_blank">jQuery&#8217;s Background-Image Transition Plugin</a> for our example.</p>
<p>First, add jQuery and the plugin</p>
<p>&lt;script lang=&#8221;Javascript&#8221; src=&#8221;path/to/jQuery.js&#8221; type=&#8221;text/javascript&#8221;&gt; &lt;/script&gt;<br />
&lt;script lang=&#8221;Javascript&#8221; src=&#8221;path/to/jQuery.bgImageTransition.js&#8221; type=&#8221;text/javascript&#8221;&gt; &lt;/script&gt;</p>
<p>Then, at the end of the document, add the following lines:</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;">jQuery<span style="color: #009900;">&#40;</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
    jQuery<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'#backImage'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">bgImageTransition</span><span style="color: #009900;">&#40;</span> <span style="color: #3366CC;">'path/to/new/image'</span><span style="color: #339933;">,</span> <span style="color: #009900;">&#123;</span>
        duration<span style="color: #339933;">:</span> <span style="color: #3366CC;">'slow'</span><span style="color: #339933;">,</span>
        easing<span style="color: #339933;">:</span> <span style="color: #3366CC;">'linear'</span><span style="color: #339933;">,</span>
        helperElementId<span style="color: #339933;">:</span> <span style="color: #3366CC;">'backImage2'</span><span style="color: #339933;">,</span>
        zindex<span style="color: #339933;">:</span> <span style="color: #339933;">-</span><span style="color: #CC0000;">1</span>
        callback<span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
           <span style="color: #006600; font-style: italic;">//do sth</span>
        <span style="color: #009900;">&#125;</span>
    <span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>The only mandatory argument is the path to the new image. The optional second argument is an object holding some tweaks. You can set the desired duration, easing, helperElementId ( which is generated by the plugin ), z-index of the helperElement ( by default it will take the selected element&#8217;s zindex and increment by 1 ) and a callback function in case you want to execute some functionality when the transition is over.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.ovalpixels.com/blog/2009/02/21/making-fancy-websites-without-flash-animating-background-image/feed/</wfw:commentRss>
		<slash:comments>33</slash:comments>
		</item>
		<item>
		<title>Building fast web sites with Yahoo!&#8217;s Exceptional Performance Team</title>
		<link>http://www.ovalpixels.com/blog/2008/11/15/building-fast-web-sites-with-yahoos-exceptional-performance-team/</link>
		<comments>http://www.ovalpixels.com/blog/2008/11/15/building-fast-web-sites-with-yahoos-exceptional-performance-team/#comments</comments>
		<pubDate>Sat, 15 Nov 2008 01:50:59 +0000</pubDate>
		<dc:creator>georgi</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[faulty software]]></category>
		<category><![CDATA[html]]></category>
		<category><![CDATA[http]]></category>
		<category><![CDATA[Performance]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[PHP algorithms]]></category>
		<category><![CDATA[software]]></category>
		<category><![CDATA[SQL]]></category>
		<category><![CDATA[Steve Souders]]></category>
		<category><![CDATA[web designers]]></category>
		<category><![CDATA[web performance]]></category>
		<category><![CDATA[Yahoo!]]></category>

		<guid isPermaLink="false">http://www.ovalpixels.com/blog/?p=19</guid>
		<description><![CDATA[Yahoo!&#8217;s Developer Theater has always been a priceless resource for web designers and developers. But what I have found the most useful video for me was Steve Souders&#8217; High performance websites presentation. For those of you who don&#8217;t have the time to watch the whole video &#8211; here is a short summary. Like many things [...]]]></description>
			<content:encoded><![CDATA[<p>Yahoo!&#8217;s Developer Theater has always been a priceless resource for web designers and developers. But what I have found the most useful video for me was Steve Souders&#8217; <a  href="http://video.yahoo.com/watch/1040890/3880720" target="_blank">High performance websites</a> presentation. For those of you who don&#8217;t have the time to watch the whole video &#8211; here is a short summary.</p>
<p>Like many things in our Universe, web performance obeys Pareto&#8217;s 80-20 principle &#8211; 20% of the elements of a website cause 80% of the effects on the performance. And if we try to slightly reduce the time spent on loading those 20% of the elements, we can get much more than 20% increase in speed.<span id="more-19"></span></p>
<h3>Are servers the root of all evil?</h3>
<p>And as most of you probably already guessed &#8211; most of the server-side elements are not within those 20%. If you slightly improve ( or think you have ) your PHP algorithms or your SQL queries, you will probably gain benefits which are close to the statistical error. ( Here we are not talking about drastic changes or bug fixes in faulty software which shouldn&#8217;t have been there in the first place ).</p>
<h3>Speed up the browser</h3>
<p>What turns out to have the greatest impact on loading times and user experiences are the elements which load into the browser. And writing speed enhancements for the browser is out of our scope right now &#8211; we can just try to adapt our web pages, so that it is easier for it to parse and display. Here are my top 5 rules which have given me fantastic results.</p>
<h4>Number of HTTP requests</h4>
<p>If we are to believe Yahoo!, 80% of the time spent loading a web page is taken by downloading the entities of that page &#8211; mainly css, javascripts and images. The problem here is that we have too much unimportant (for the users) data sent back and forth, also known as <em>headers</em>. Even the smallest image has its request and response headers traveling with it across the Net. So, my advice is &#8211; combine your javascript and css files and use css sprites&#8217; images. These are image maps which hold all of your images in one file and thus only this single file is sent over with its headers. Read more on css sprites <a  href="http://alistapart.com/articles/sprites" target="_blank">here</a>.</p>
<h4>Expires header</h4>
<p>This technique is very simple, yet very powerful and rarely used. Expires headers tell the browser that the entity it has requested *will not be changed* until some date. In practice, this means that the browser will not download that entity, if it already has it in its cache &#8211; 0 bytes transfered. Be careful, though, if you need to change something on the fly ( especially when still developing a site ), you will have to change the name of that file, so that the browser doesn&#8217;t think it already has it in the cache. This can easily be avoided using a simple versioning technique ( a link to some-file.js can look like some-file.js?version=1.0 and can later be changed to some-file.js?version=1.1 which will instantly make the browser fetch the file again as the url has changed ).</p>
<p>So, here &#8211; simply set a far-future Expires header on static content.</p>
<h4>GZip</h4>
<p>Also very useful, especially on large text files (like css and javascript files). This will effectively compress your content on the server, then send it to the browser which will uncompress it and use it. But be careful &#8211; don&#8217;t use this on images as it can be counter-productive. All A grade browsers support gzipped responses, so no worries about compatibility here.</p>
<h4>Javascript and CSS</h4>
<p>You should already know this but just in case &#8211; compress and minify your javascript and css files; put css at the top and javascript at the bottom. Simple, heh?</p>
<h4>Flush it!</h4>
<p>Well, the only server-side technique in my top 5 &#8211; flush your output buffer early ( just after the &lt;head&gt; tag ). This is very helpful on sites rich in html and text content because it will send the &lt;head&gt; of the html document fast enough so that the browser may start downloading the respective css files ( which you have put in the head, as described in the previous rule ) and underlying css images before the rest of the document has been transfered. Otherwise, you may end up in a situation where the whole HTML document needs to be received before css and the images can start being fetched.</p>
<p>This is just a sneak overview of the techniques &#8211; for a thorough list and technical help, please visit <a  href="http://developer.yahoo.com/performance/rules.html" target="_blank">yahoo&#8217;s site</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.ovalpixels.com/blog/2008/11/15/building-fast-web-sites-with-yahoos-exceptional-performance-team/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>

