<?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/"
	>

<channel>
	<title>Emanuele Feronato &#187; Css</title>
	<atom:link href="http://www.emanueleferonato.com/category/css/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.emanueleferonato.com</link>
	<description>italian geek and PROgrammer</description>
	<lastBuildDate>Mon, 06 Feb 2012 14:28:18 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=</generator>
		<item>
		<title>Full screen centered background image with CSS and jQuery # 2</title>
		<link>http://www.emanueleferonato.com/2010/11/16/full-screen-centered-background-image-with-css-and-jquery-2/</link>
		<comments>http://www.emanueleferonato.com/2010/11/16/full-screen-centered-background-image-with-css-and-jquery-2/#comments</comments>
		<pubDate>Tue, 16 Nov 2010 21:41:44 +0000</pubDate>
		<dc:creator>Emanuele Feronato</dc:creator>
				<category><![CDATA[Css]]></category>
		<category><![CDATA[Html]]></category>
		<category><![CDATA[Javascript]]></category>

		<guid isPermaLink="false">http://www.emanueleferonato.com/?p=3515</guid>
		<description><![CDATA[There are a couple of improvements to do to Full screen centered background image with CSS and jQuery to add some functionality such as window resizing management and make it compatible with Opera. First, you should change the CSS to &#60;style type=&#34;text/css&#34;&#62; #triquiback&#123; left: 0; top: 0; position:fixed; overflow:hidden; zIndex: -9999 &#125; #triquibackimg&#123; position:relative &#125; [...]]]></description>
			<content:encoded><![CDATA[<p>There are a couple of improvements to do to <a href="http://www.emanueleferonato.com/2010/11/13/full-screen-centered-background-image-with-css-and-jquery/">Full screen centered background image with CSS and jQuery</a> to add some functionality such as window resizing management and make it compatible with Opera.</p>
<p>First, you should change the CSS to</p>

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;">&lt;style type<span style="color: #00AA00;">=</span><span style="color: #ff0000;">&quot;text/css&quot;</span><span style="color: #00AA00;">&gt;</span>
     <span style="color: #cc00cc;">#triquiback</span><span style="color: #00AA00;">&#123;</span>
          <span style="color: #000000; font-weight: bold;">left</span><span style="color: #00AA00;">:</span> <span style="color: #cc66cc;">0</span><span style="color: #00AA00;">;</span>
          <span style="color: #000000; font-weight: bold;">top</span><span style="color: #00AA00;">:</span> <span style="color: #cc66cc;">0</span><span style="color: #00AA00;">;</span>
          <span style="color: #000000; font-weight: bold;">position</span><span style="color: #00AA00;">:</span><span style="color: #993333;">fixed</span><span style="color: #00AA00;">;</span>
          <span style="color: #000000; font-weight: bold;">overflow</span><span style="color: #00AA00;">:</span><span style="color: #993333;">hidden</span><span style="color: #00AA00;">;</span>
          zIndex<span style="color: #00AA00;">:</span> -<span style="color: #cc66cc;">9999</span>
     <span style="color: #00AA00;">&#125;</span>
     <span style="color: #cc00cc;">#triquibackimg</span><span style="color: #00AA00;">&#123;</span>
          <span style="color: #000000; font-weight: bold;">position</span><span style="color: #00AA00;">:</span><span style="color: #993333;">relative</span>    
     <span style="color: #00AA00;">&#125;</span>      
&lt;/style<span style="color: #00AA00;">&gt;</span></pre></div></div>

<p>Setting <code>triquibackimg</code>&#8216;s position to <code>relative</code> rather than <code>fixed</code> will make it work in Opera too. Then since we want to resize the background image when it loads and when the user resizes the browser, I made a function to handle resizing:<span id="more-3515"></span></p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
</pre></td><td class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #003366; font-weight: bold;">function</span> resize_bg<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
     $<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;#triquibackimg&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">css</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;left&quot;</span><span style="color: #339933;">,</span><span style="color: #3366CC;">&quot;0&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
     <span style="color: #003366; font-weight: bold;">var</span> doc_width <span style="color: #339933;">=</span> $<span style="color: #009900;">&#40;</span>window<span style="color: #009900;">&#41;</span>.<span style="color: #660066;">width</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
     <span style="color: #003366; font-weight: bold;">var</span> doc_height <span style="color: #339933;">=</span> $<span style="color: #009900;">&#40;</span>window<span style="color: #009900;">&#41;</span>.<span style="color: #660066;">height</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
     <span style="color: #003366; font-weight: bold;">var</span> image_width <span style="color: #339933;">=</span> $<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;#triquibackimg&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">width</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
     <span style="color: #003366; font-weight: bold;">var</span> image_height <span style="color: #339933;">=</span> $<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;#triquibackimg&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">height</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
     <span style="color: #003366; font-weight: bold;">var</span> image_ratio <span style="color: #339933;">=</span> image_width<span style="color: #339933;">/</span>image_height<span style="color: #339933;">;</span>      
     <span style="color: #003366; font-weight: bold;">var</span> new_width <span style="color: #339933;">=</span> doc_width<span style="color: #339933;">;</span>
     <span style="color: #003366; font-weight: bold;">var</span> new_height <span style="color: #339933;">=</span> Math.<span style="color: #660066;">round</span><span style="color: #009900;">&#40;</span>new_width<span style="color: #339933;">/</span>image_ratio<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
     <span style="color: #000066; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span>new_height<span style="color: #339933;">&lt;</span>doc_height<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
          new_height <span style="color: #339933;">=</span> doc_height<span style="color: #339933;">;</span>
          new_width <span style="color: #339933;">=</span> Math.<span style="color: #660066;">round</span><span style="color: #009900;">&#40;</span>new_height<span style="color: #339933;">*</span>image_ratio<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
          <span style="color: #003366; font-weight: bold;">var</span> width_offset <span style="color: #339933;">=</span> Math.<span style="color: #660066;">round</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span>new_width<span style="color: #339933;">-</span>doc_width<span style="color: #009900;">&#41;</span><span style="color: #339933;">/</span><span style="color: #CC0000;">2</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
          $<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;#triquibackimg&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">css</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;left&quot;</span><span style="color: #339933;">,</span><span style="color: #3366CC;">&quot;-&quot;</span><span style="color: #339933;">+</span>width_offset<span style="color: #339933;">+</span><span style="color: #3366CC;">&quot;px&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
     <span style="color: #009900;">&#125;</span>
     $<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;#triquibackimg&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">width</span><span style="color: #009900;">&#40;</span>new_width<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
     $<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;#triquibackimg&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">height</span><span style="color: #009900;">&#40;</span>new_height<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p>I removed all the alerts since they became useless. First, I reset image&#8217;s left position to zero (<strong>line 2</strong>), to align it to top left corner. I am doing this because at <strong>line 14</strong> left position can be changed due to background alignment.</p>
<p>The remaining script is the same you saw at <a href="http://www.emanueleferonato.com/2010/11/13/full-screen-centered-background-image-with-css-and-jquery/">step 1</a>, with the only exception <code>doc_width</code> and <code>doc_height</code> are determined according to window size rather than document size. I found it to be more accurate.</p>
<p>At this time, the entire javascript can be written this way:</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;">$<span style="color: #009900;">&#40;</span>document<span style="color: #009900;">&#41;</span>.<span style="color: #660066;">ready</span><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>
     $<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;#triquibackimg&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">load</span><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>
          resize_bg<span style="color: #009900;">&#40;</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: #009900;">&#40;</span>window<span style="color: #009900;">&#41;</span>.<span style="color: #660066;">resize</span><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>
          resize_bg<span style="color: #009900;">&#40;</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: #003366; font-weight: bold;">function</span> resize_bg<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
          $<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;#triquibackimg&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">css</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;left&quot;</span><span style="color: #339933;">,</span><span style="color: #3366CC;">&quot;0&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
          <span style="color: #003366; font-weight: bold;">var</span> doc_width <span style="color: #339933;">=</span> $<span style="color: #009900;">&#40;</span>window<span style="color: #009900;">&#41;</span>.<span style="color: #660066;">width</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
          <span style="color: #003366; font-weight: bold;">var</span> doc_height <span style="color: #339933;">=</span> $<span style="color: #009900;">&#40;</span>window<span style="color: #009900;">&#41;</span>.<span style="color: #660066;">height</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
          <span style="color: #003366; font-weight: bold;">var</span> image_width <span style="color: #339933;">=</span> $<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;#triquibackimg&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">width</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
          <span style="color: #003366; font-weight: bold;">var</span> image_height <span style="color: #339933;">=</span> $<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;#triquibackimg&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">height</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
          <span style="color: #003366; font-weight: bold;">var</span> image_ratio <span style="color: #339933;">=</span> image_width<span style="color: #339933;">/</span>image_height<span style="color: #339933;">;</span>      
          <span style="color: #003366; font-weight: bold;">var</span> new_width <span style="color: #339933;">=</span> doc_width<span style="color: #339933;">;</span>
          <span style="color: #003366; font-weight: bold;">var</span> new_height <span style="color: #339933;">=</span> Math.<span style="color: #660066;">round</span><span style="color: #009900;">&#40;</span>new_width<span style="color: #339933;">/</span>image_ratio<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
          <span style="color: #000066; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span>new_height<span style="color: #339933;">&lt;</span>doc_height<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
               new_height <span style="color: #339933;">=</span> doc_height<span style="color: #339933;">;</span>
               new_width <span style="color: #339933;">=</span> Math.<span style="color: #660066;">round</span><span style="color: #009900;">&#40;</span>new_height<span style="color: #339933;">*</span>image_ratio<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
               <span style="color: #003366; font-weight: bold;">var</span> width_offset <span style="color: #339933;">=</span> Math.<span style="color: #660066;">round</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span>new_width<span style="color: #339933;">-</span>doc_width<span style="color: #009900;">&#41;</span><span style="color: #339933;">/</span><span style="color: #CC0000;">2</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
               $<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;#triquibackimg&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">css</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;left&quot;</span><span style="color: #339933;">,</span><span style="color: #3366CC;">&quot;-&quot;</span><span style="color: #339933;">+</span>width_offset<span style="color: #339933;">+</span><span style="color: #3366CC;">&quot;px&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
          <span style="color: #009900;">&#125;</span>
          $<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;#triquibackimg&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">width</span><span style="color: #009900;">&#40;</span>new_width<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
          $<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;#triquibackimg&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">height</span><span style="color: #009900;">&#40;</span>new_height<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
     <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>As you can see, <code>resize_bg</code> function is called both when the background image is loaded and when the window is resized.</p>
<p>You can see the final result <a href="http://www.emanueleferonato.com/stuff/triquibg/" target = "_blank">here</a> and copy the entire source code by looking at the html.</p>
<p>Next steps will be the creation of a standalone jQuery plugin and a WordPress plugin too. Stay tuned.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.emanueleferonato.com/2010/11/16/full-screen-centered-background-image-with-css-and-jquery-2/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>Full screen centered background image with CSS and jQuery</title>
		<link>http://www.emanueleferonato.com/2010/11/13/full-screen-centered-background-image-with-css-and-jquery/</link>
		<comments>http://www.emanueleferonato.com/2010/11/13/full-screen-centered-background-image-with-css-and-jquery/#comments</comments>
		<pubDate>Sat, 13 Nov 2010 14:18:43 +0000</pubDate>
		<dc:creator>Emanuele Feronato</dc:creator>
				<category><![CDATA[Css]]></category>
		<category><![CDATA[Html]]></category>
		<category><![CDATA[Javascript]]></category>

		<guid isPermaLink="false">http://www.emanueleferonato.com/?p=3502</guid>
		<description><![CDATA[Recently a lot of sites feature a full screen background image. Full screen background images can be used to give some sort of liquid effect to fixed layouts, or just to show full screen images in some special occurrences, such as Christmas or the launch of a new service. This is what you&#8217;ll get: demo. [...]]]></description>
			<content:encoded><![CDATA[<p>Recently a lot of sites feature a full screen background image. Full screen background images can be used to give some sort of liquid effect to fixed layouts, or just to show full screen images in some special occurrences, such as Christmas or the launch of a new service.</p>
<p>This is what you&#8217;ll get: <a target = "_blank" href="http://www.emanueleferonato.com/stuff/triquibg/">demo</a>.</p>
<p>Before you continue reading this post, I have to warn you the title is misleading: you won&#8217;t center any background image. You are going to achieve this effect by using an image in div with a a low z-index.</p>
<p>During this example we&#8217;ll use a <a target = "_blank" href="http://www.flickr.com/photos/iawob/5106469437/">this photo</a> by <a target = "_blank" href="http://www.flickr.com/photos/iawob/">horlo</a>.</p>
<p><strong>HTML</strong></p>
<p>As said, it&#8217;s an image inside a div, so let&#8217;s create them:</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">&lt;!DOCTYPE html PUBLIC &quot;-//W3C//DTD XHTML 1.0 Transitional//EN&quot;
&quot;http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd&quot;&gt;
&nbsp;
&lt;html xmlns=&quot;http://www.w3.org/1999/xhtml&quot;&gt;
&lt;head&gt;&lt;/head&gt;
&lt;body&gt;
     &lt;div id = &quot;triquiback&quot;&gt;
          &lt;img id = &quot;triquibackimg&quot; src = &quot;bg.jpg&quot; /&gt;
     &lt;/div&gt;
&lt;/body&gt;
&lt;/html&gt;</pre></div></div>

<p>The div has an id called <code>triquiback</code> while the image has <code>triquibackimg</code>. It should be the first thing you add after <code>body</code> opening.<span id="more-3502"></span></p>
<p><strong>CSS</strong></p>
<p>z-index and positions will be defined with CSS this way:</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">&lt;!DOCTYPE html PUBLIC &quot;-//W3C//DTD XHTML 1.0 Transitional//EN&quot;
&quot;http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd&quot;&gt;
&nbsp;
&lt;html xmlns=&quot;http://www.w3.org/1999/xhtml&quot;&gt;
&lt;head&gt;
     &lt;style type=&quot;text/css&quot;&gt;
          #triquiback{
               position:fixed;
               left: 0;
               top: 0;
               overflow:hidden;
               zIndex: -9999
          }
          #triquibackimg{
               position:fixed
          }
     &lt;/style&gt;
&lt;/head&gt;
&lt;body&gt;
     &lt;div id = &quot;triquiback&quot;&gt;
          &lt;img id = &quot;triquibackimg&quot; src = &quot;bg.jpg&quot; /&gt;
     &lt;/div&gt;
&lt;/body&gt;
&lt;/html&gt;</pre></div></div>

<p>Notice the z-index of #triquiback and its overflow: being an <code>&lt;img /%gt;</code> image and not a background, I had to set the overflow to hidden to prevent unwanted scrollbars. Also, the left and top positions are set to zero to override body margins and paddings.</p>
<p>Both the div and the image have <code>fixed</code> position to allow to easily place them with <code>left</code> and <code>top</code>.</p>
<p><strong>jQuery</strong></p>
<p>jQuery will allow us to resize the image as we want.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
</pre></td><td class="code"><pre class="javascript" style="font-family:monospace;">&lt;!DOCTYPE html PUBLIC &quot;-//W3C//DTD XHTML 1.0 Transitional//EN&quot;
&quot;http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd&quot;&gt;
&nbsp;
&lt;html xmlns=&quot;http://www.w3.org/1999/xhtml&quot;&gt;
&lt;head&gt;
     &lt;script src=&quot;http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js&quot; type=&quot;text/javascript&quot;&gt;&lt;/script&gt;
     &lt;title&gt;AUTO RESIZE BACKGROUND IMAGE&lt;/title&gt;
     <span style="color: #339933;">&lt;</span>script type<span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;text/javascript&quot;</span><span style="color: #339933;">&gt;</span>
     $<span style="color: #009900;">&#40;</span>document<span style="color: #009900;">&#41;</span>.<span style="color: #660066;">ready</span><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>
          $<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;#triquibackimg&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">load</span><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>
               <span style="color: #003366; font-weight: bold;">var</span> doc_width <span style="color: #339933;">=</span> $<span style="color: #009900;">&#40;</span>document<span style="color: #009900;">&#41;</span>.<span style="color: #660066;">width</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
               <span style="color: #003366; font-weight: bold;">var</span> doc_height <span style="color: #339933;">=</span> $<span style="color: #009900;">&#40;</span>document<span style="color: #009900;">&#41;</span>.<span style="color: #660066;">height</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
               <span style="color: #000066;">alert</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;Step 1: getting document size<span style="color: #000099; font-weight: bold;">\n</span><span style="color: #000099; font-weight: bold;">\n</span>Width: &quot;</span><span style="color: #339933;">+</span>doc_width<span style="color: #339933;">+</span><span style="color: #3366CC;">&quot;px<span style="color: #000099; font-weight: bold;">\n</span>Height = &quot;</span><span style="color: #339933;">+</span>doc_height<span style="color: #339933;">+</span><span style="color: #3366CC;">&quot;px&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
               <span style="color: #003366; font-weight: bold;">var</span> image_width <span style="color: #339933;">=</span> $<span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">width</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
               <span style="color: #003366; font-weight: bold;">var</span> image_height <span style="color: #339933;">=</span> $<span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">height</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
               <span style="color: #000066;">alert</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;Step 2: getting image size<span style="color: #000099; font-weight: bold;">\n</span><span style="color: #000099; font-weight: bold;">\n</span>Width: &quot;</span><span style="color: #339933;">+</span>image_width<span style="color: #339933;">+</span><span style="color: #3366CC;">&quot;px<span style="color: #000099; font-weight: bold;">\n</span>Height = &quot;</span><span style="color: #339933;">+</span>image_height<span style="color: #339933;">+</span><span style="color: #3366CC;">&quot;px&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
               <span style="color: #003366; font-weight: bold;">var</span> image_ratio <span style="color: #339933;">=</span> image_width<span style="color: #339933;">/</span>image_height<span style="color: #339933;">;</span>
               <span style="color: #000066;">alert</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;Step 3: getting image width/height ratio: &quot;</span><span style="color: #339933;">+</span>image_ratio<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>       
               <span style="color: #003366; font-weight: bold;">var</span> new_width <span style="color: #339933;">=</span> doc_width<span style="color: #339933;">;</span>
               <span style="color: #003366; font-weight: bold;">var</span> new_height <span style="color: #339933;">=</span> Math.<span style="color: #660066;">round</span><span style="color: #009900;">&#40;</span>new_width<span style="color: #339933;">/</span>image_ratio<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
               <span style="color: #000066;">alert</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;Step 4: adapting the image to document width, mantaining the ratio<span style="color: #000099; font-weight: bold;">\n</span><span style="color: #000099; font-weight: bold;">\n</span>Width: &quot;</span><span style="color: #339933;">+</span>new_width<span style="color: #339933;">+</span><span style="color: #3366CC;">&quot;px<span style="color: #000099; font-weight: bold;">\n</span>Height = &quot;</span><span style="color: #339933;">+</span>new_height<span style="color: #339933;">+</span><span style="color: #3366CC;">&quot;px&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
               $<span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">width</span><span style="color: #009900;">&#40;</span>new_width<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
               $<span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">height</span><span style="color: #009900;">&#40;</span>new_height<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
               <span style="color: #000066; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span>new_height<span style="color: #339933;">&lt;</span>doc_height<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
                    new_height <span style="color: #339933;">=</span> doc_height<span style="color: #339933;">;</span>
                    new_width <span style="color: #339933;">=</span> Math.<span style="color: #660066;">round</span><span style="color: #009900;">&#40;</span>new_height<span style="color: #339933;">*</span>image_ratio<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
                    <span style="color: #000066;">alert</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;Step 5: the image isn't high enough<span style="color: #000099; font-weight: bold;">\n</span><span style="color: #000099; font-weight: bold;">\n</span>Adapting the image to document height, mantaining the ratio<span style="color: #000099; font-weight: bold;">\n</span><span style="color: #000099; font-weight: bold;">\n</span>Width: &quot;</span><span style="color: #339933;">+</span>new_width<span style="color: #339933;">+</span><span style="color: #3366CC;">&quot;px<span style="color: #000099; font-weight: bold;">\n</span>Height = &quot;</span><span style="color: #339933;">+</span>new_height<span style="color: #339933;">+</span><span style="color: #3366CC;">&quot;px&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
                    $<span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">width</span><span style="color: #009900;">&#40;</span>new_width<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
                    $<span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">height</span><span style="color: #009900;">&#40;</span>new_height<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
                    <span style="color: #003366; font-weight: bold;">var</span> width_offset <span style="color: #339933;">=</span> Math.<span style="color: #660066;">round</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span>new_width<span style="color: #339933;">-</span>doc_width<span style="color: #009900;">&#41;</span><span style="color: #339933;">/</span><span style="color: #CC0000;">2</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
                    <span style="color: #000066;">alert</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;Step 6: moving the image left by &quot;</span><span style="color: #339933;">+</span>width_offset<span style="color: #339933;">+</span><span style="color: #3366CC;">&quot;px to have it centered&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
                    $<span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">css</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;left&quot;</span><span style="color: #339933;">,</span><span style="color: #3366CC;">&quot;-&quot;</span><span style="color: #339933;">+</span>width_offset<span style="color: #339933;">+</span><span style="color: #3366CC;">&quot;px&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
               <span style="color: #009900;">&#125;</span>
               <span style="color: #000066;">alert</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;Yeah!! Done :)&quot;</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: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
     <span style="color: #339933;">&lt;/</span>script<span style="color: #339933;">&gt;</span>
     &lt;style type=&quot;text/css&quot;&gt;
          #triquiback{
               left: 0;
               top: 0;
               position:fixed;
               overflow:hidden;
               zIndex: -9999
          }
          #triquibackimg{
               position:fixed
          }
     &lt;/style&gt;
&lt;/head&gt;
&lt;body&gt;
     &lt;div id = &quot;triquiback&quot;&gt;
          &lt;img id = &quot;triquibackimg&quot; src = &quot;bg.jpg&quot; /&gt;
     &lt;/div&gt;
&lt;/body&gt;
&lt;/html&gt;</pre></td></tr></table></div>

<p>At <strong>line 6</strong> I import jQuery library using Google as CDN.</p>
<p>The code is filled with alerts which will guide you through the <a target = "_blank" href="http://www.emanueleferonato.com/stuff/triquibg/">demo</a>, obviously you can remove them from your project.</p>
<p><strong>Line 9</strong>: Function to be executed once the document is ready</p>
<p><strong>Line 10</strong>: Function to be executed once the &#8220;background&#8221; image is loaded</p>
<p><strong>Lines 11-12</strong>: Getting document area with and height</p>
<p><strong>Lines 14-15</strong>: Getting &#8220;background&#8221; image width and height</p>
<p><strong>Line 17</strong>: Determining image ratio as width/height</p>
<p><strong>Line 19</strong>: Setting image width equal to document width</p>
<p><strong>Line 20</strong>: Adjusting image height according to new image width and image ratio</p>
<p><strong>Lines 22-23</strong>: Resizing the image</p>
<p><strong>Line 24</strong>: Checking if the new image height is shorter than document height. In this case we need to resize the image again</p>
<p><strong>Line 25</strong>: Setting image height equal to document height</p>
<p><strong>Line 26</strong>: Adjusting image width according to new image height and image ratio</p>
<p><strong>Lines 28-29</strong>: Resizing the image. At this time, we need to horizontally center the image</p>
<p><strong>Line 30</strong>: Calculating half of the difference between new image width and document width</p>
<p><strong>Line 32</strong>: Adding a style to image to move it by such difference to the right</p>
<p>And that&#8217;s it. You can check the demo <a target = "_blank" href="http://www.emanueleferonato.com/stuff/triquibg/">here</a>. In case of positive feedback, I&#8217;ll show you how to resize image on the fly when the browser is resized, and add an overlay to image.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.emanueleferonato.com/2010/11/13/full-screen-centered-background-image-with-css-and-jquery/feed/</wfw:commentRss>
		<slash:comments>25</slash:comments>
		</item>
		<item>
		<title>Playing with Google Font API and WordPress</title>
		<link>http://www.emanueleferonato.com/2010/05/24/google-font-api-and-wordpress/</link>
		<comments>http://www.emanueleferonato.com/2010/05/24/google-font-api-and-wordpress/#comments</comments>
		<pubDate>Mon, 24 May 2010 10:27:13 +0000</pubDate>
		<dc:creator>Emanuele Feronato</dc:creator>
				<category><![CDATA[Css]]></category>
		<category><![CDATA[WordPress]]></category>

		<guid isPermaLink="false">http://www.emanueleferonato.com/?p=2935</guid>
		<description><![CDATA[With new webdesign trends, standard fonts such as Arial, Times and Verdana aren&#8217;t enough to give our blog/website the loon&#038;feel we want. That&#8217;s why today we&#8217;ll discover the magic of Google Font API. The Google Font API lets you include in your pages high-quality web fonts provided by the Google Font Directory. This means you [...]]]></description>
			<content:encoded><![CDATA[<p>With new webdesign trends, standard fonts such as Arial, Times and Verdana aren&#8217;t enough to give our blog/website the loon&#038;feel we want.</p>
<p>That&#8217;s why today we&#8217;ll discover the magic of <a href="http://code.google.com/apis/webfonts/" target = "_blank"><strong>Google Font API</strong></a>.</p>
<p><a href="http://code.google.com/apis/webfonts/" target = "_blank"><img src="/wp-content/uploads/2010/05/font_api-128.gif" /></a></p>
<p>The Google Font API lets you include in your pages high-quality web fonts provided by the <a href="http://code.google.com/webfonts">Google Font Directory</a>.</p>
<p>This means you can use custom fonts in your design, and they are hosted and served by Google.</p>
<p>That&#8217;s nothing new, since services like <atarget = "_blank" href="http://typekit.com/">Typekit</a> are already on the wild for quite a while, and scripts like <a href="http://cufon.shoqolate.com/generate/" target = "_blank">cufòn</a> already enhance the beauty of most premium templates.</p>
<p>But unlike cufòn, texts rendered with the Google Font API are selectable, and there isn&#8217;t any copyright issue, and unlike Typekit, Google Font API is free.</p>
<p>So let me show you the simplest example&#8230;<span id="more-2935"></span></p>
<p>Let&#8217;s take the CSS of this blog post titles:</p>

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;"><span style="color: #cc00cc;">#content</span> h1 <span style="color: #00AA00;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">font-family</span><span style="color: #00AA00;">:</span> <span style="color: #ff0000;">&quot;Times New Roman&quot;</span><span style="color: #00AA00;">;</span>   
	<span style="color: #000000; font-weight: bold;">font-size</span><span style="color: #00AA00;">:</span><span style="color: #933;">24px</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">font-weight</span><span style="color: #00AA00;">:</span><span style="color: #993333;">normal</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">text-align</span><span style="color: #00AA00;">:</span> <span style="color: #000000; font-weight: bold;">left</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">margin</span><span style="color: #00AA00;">:</span> <span style="color: #933;">10px</span> <span style="color: #933;">0px</span> <span style="color: #933;">5px</span> <span style="color: #933;">0px</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">color</span><span style="color: #00AA00;">:</span> <span style="color: #cc00cc;">#181818</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">text-transform</span><span style="color: #00AA00;">:</span><span style="color: #993333;">uppercase</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">border-left</span><span style="color: #00AA00;">:</span><span style="color: #933;">15px</span> <span style="color: #993333;">solid</span> <span style="color: #cc00cc;">#242424</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">padding-left</span><span style="color: #00AA00;">:</span><span style="color: #933;">10px</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span></pre></div></div>

<p>and change the first line to</p>

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">font-family</span><span style="color: #00AA00;">:</span> <span style="color: #ff0000;">&quot;Yanone Kaffeesatz&quot;</span><span style="color: #00AA00;">,</span> <span style="color: #ff0000;">&quot;Times New Roman&quot;</span><span style="color: #00AA00;">;</span></pre></div></div>

<p>and then just add somewhere between <code>&lt;head&gt;</code> and <code>&lt;/head&gt;</code> (normally in the header.php file located in your theme directory)</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">&lt;link href='http://fonts.googleapis.com/css?family=Yanone+Kaffeesatz' rel='stylesheet' type='text/css'&gt;</pre></div></div>

<p>and&#8230; see the difference:</p>
<p><img src="/wp-content/uploads/2010/05/googleapi.png" /></p>
<p>Nice, elegant and without any important downside, if you can bare with a small number of fonts (but don&#8217;t forget we are talking about Google, so expect the number to grow fast) and the lack of iPhone/iPad compatibility (hey&#8230; shouldn&#8217;t CSS heroes design a i/whatever specific layout anyway?)</p>
]]></content:encoded>
			<wfw:commentRss>http://www.emanueleferonato.com/2010/05/24/google-font-api-and-wordpress/feed/</wfw:commentRss>
		<slash:comments>12</slash:comments>
		</item>
		<item>
		<title>JQuery powered lights off effect</title>
		<link>http://www.emanueleferonato.com/2009/10/12/jquery-powered-lights-off-effect/</link>
		<comments>http://www.emanueleferonato.com/2009/10/12/jquery-powered-lights-off-effect/#comments</comments>
		<pubDate>Mon, 12 Oct 2009 14:58:07 +0000</pubDate>
		<dc:creator>Emanuele Feronato</dc:creator>
				<category><![CDATA[Css]]></category>
		<category><![CDATA[Html]]></category>
		<category><![CDATA[Javascript]]></category>

		<guid isPermaLink="false">http://www.emanueleferonato.com/?p=1735</guid>
		<description><![CDATA[A couple of days ago a fan of my Facebook page asked me for a script to make the effect you see on this page. Obviously simply reverse-engineering the script wouldn&#8217;t be enough for me, so I decided to create a lights off effect that make any content in a given div remain highlighted while [...]]]></description>
			<content:encoded><![CDATA[<p>A couple of days ago a fan of <a target = "_blank" href="http://www.facebook.com/pages/Emanuele-Feronato/50374255154">my Facebook page</a> asked me for a script to make the effect you see on <a href="http://test.jackread.co.uk/LightsOff/lightsoff.htm" target = "_blank">this page</a>.</p>
<p>Obviously simply reverse-engineering the script wouldn&#8217;t be enough for me, so I decided to create a lights off effect that make <strong>any</strong> content in a given <code>div</code> remain highlighted while the rest of the page fades to black (or to any color).</p>
<p>I used <a target = "_blank" href="http://jquery.com/">JQuery</a> to manage the fade effect because it&#8217;s the best Javascript library available at the moment.</p>
<p>As a developer, I also tried MooTools and scriptaculous but believe me <a target = "_blank" href="http://jquery.com/">JQuery</a> is some steps ahead.</p>
<p>Now let&#8217;s see this script:<span id="more-1735"></span></p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
</pre></td><td class="code"><pre class="html" style="font-family:monospace;">&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.01 Transitional//EN&quot;&gt;
&lt;html&gt;
     &lt;head&gt;
          &lt;title&gt;Emanuele Feronato's lights off effect&lt;/title&gt;
          &lt;script type=&quot;text/javascript&quot; src=&quot;jquery-1.3.2.min.js&quot;&gt;&lt;/script&gt;
          &lt;script&gt;
               $(document).ready(function(){
                    $(&quot;#the_lights&quot;).fadeTo(1,0);
                    $(&quot;#turnoff&quot;).click(function () {
                         $(&quot;#the_lights&quot;).css({'display' : 'block'});
                         $(&quot;#the_lights&quot;).fadeTo(&quot;slow&quot;,1);
                    });
                    $(&quot;#soft&quot;).click(function () {
                         document.getElementById(&quot;the_lights&quot;).style.display=&quot;block&quot;;
                         $(&quot;#the_lights&quot;).fadeTo(&quot;slow&quot;,0.8);
                    });
                    $(&quot;#turnon&quot;).click(function () {
                         document.getElementById(&quot;the_lights&quot;).style.display=&quot;block&quot;;
                         $(&quot;#the_lights&quot;).fadeTo(&quot;slow&quot;,0);
                    });
               });
          &lt;/script&gt;
          &lt;style&gt;
               html{
                    width:100%;
                    height:100%;
                    margin:0px;
               }
               #the_lights{
	              background-color:#000;
	              height:100%;
	              width:100%;
	              position:absolute;
	              top:0;
	              left:0;
	              display:none;
               }
               #standout{
                    padding:5px;
                    background-color:white;
                    position:relative;
                    z-index:1000;
               }
          &lt;/style&gt;
     &lt;/head&gt;
&lt;body&gt;
     &lt;p&gt;Lorem ipsum dolor sit amet, consectetur adipiscing elit. Maecenas scelerisque libero euismod nulla porttitor egestas. Nulla fermentum facilisis sagittis. Vestibulum commodo pretium diam, vitae scelerisque lectus bibendum nec. Curabitur a metus est. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Sed nunc dolor, pretium eget venenatis ut, condimentum at sem. Vivamus rhoncus ullamcorper turpis. Aliquam sit amet risus diam, vel mattis est. Quisque sodales eros id nulla rhoncus posuere. Nullam accumsan lorem quis dolor tempor congue. Vivamus ligula augue, commodo malesuada tempor non, tristique id enim. Sed dapibus sagittis porttitor. Suspendisse faucibus scelerisque eros, ac hendrerit orci scelerisque sit amet.&lt;/p&gt;
     &lt;div id = &quot;standout&quot;&gt;&lt;p&gt;Everything inside this div will remain highlighted&lt;/p&gt;&lt;div id = &quot;turnoff&quot;&gt;Lights off&lt;/div&gt;&lt;div id = &quot;soft&quot;&gt;Soft lights&lt;/div&gt;&lt;div id = &quot;turnon&quot;&gt;Lights on&lt;/div&gt;&lt;/div&gt;
     &lt;p&gt;Vestibulum interdum, odio ut congue imperdiet, justo ligula bibendum nisl, ac placerat orci eros nec tortor. Maecenas rhoncus felis vitae elit consectetur vitae mattis metus tincidunt. Donec nec ipsum quis tellus posuere ultricies. Ut tempus tortor nec sem blandit ut facilisis nisl scelerisque. Nulla venenatis ante sit amet nisi dictum varius. Etiam congue dui eu diam fermentum et tincidunt magna egestas. Sed tincidunt magna et metus molestie malesuada. Nam tempus dignissim porta. Vivamus iaculis, orci hendrerit condimentum viverra, eros nisl euismod arcu, nec pulvinar tellus elit eu nulla. Vestibulum mattis, ligula sit amet euismod commodo, augue lorem fermentum magna, et rhoncus nisl urna nec purus. Suspendisse potenti. Fusce fermentum orci at orci posuere ornare a imperdiet justo. In hac habitasse platea dictumst. Duis adipiscing leo nec risus varius auctor. Cras sed erat massa, quis egestas leo. Vivamus dignissim lacinia leo, ac interdum nisi facilisis eget.&lt;/p&gt;
     &lt;div id=&quot;the_lights&quot;&gt;&lt;/div&gt;
&lt;/body&gt;
&lt;/html&gt;</pre></td></tr></table></div>

<p>The <code>div</code> is the one called <code>standout</code> at <strong>line 48</strong> and it has nothing special but a background color (it can&#8217;t be transparent) and a z-index along with a relative position (<strong>lines 40-42</strong>).</p>
<p>Obviously the z-index should be higher than the rest of the elements.</p>
<p>The other interesting <code>div</code> is <code>the_lights</code> (<strong>line 50</strong>), a black div covering all the page, initially invisible (<strong>lines 30-36</strong>). Playing with its transparency will simulate the lights effect</p>
<p>Now it&#8217;s all a matter of JQuery:</p>
<p><strong>Line 7</strong>: Listening for the document to be ready</p>
<p><strong>Line 8</strong>: Once it&#8217;s ready, the first thing is setting <code>the_lights</code> alpha to zero. I don&#8217;t set it from CSS but use <code>fadeTo</code> because I need to initialize the fading process. The entire lights out effect is just playing with <code>the_lights</code> and some tweening.</p>
<p><strong>Line 9</strong>: Here I am listening for the <code>turnoff</code> div to be clicked</p>
<p><strong>Line 10</strong>: Showing <code>the_lights</code> div&#8230; this is the same thing as<br />
<code>document.getElementById('the_lights').style.display='block'</code></p>
<p><strong>Line 11</strong>: Fading the black div to full opacity.</p>
<p>This will give the &#8220;lights out effect&#8221;</p>
<p>Try the <a href="/stuff/lightsoff/" target = "_blank">example at this page</a> will show you the effect&#8230; click on &#8220;lights on&#8221;, &#8220;lights off&#8221; or &#8220;soft lights&#8221; and see what happens.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.emanueleferonato.com/2009/10/12/jquery-powered-lights-off-effect/feed/</wfw:commentRss>
		<slash:comments>15</slash:comments>
		</item>
		<item>
		<title>MagOrMin &#8211; an old php based game</title>
		<link>http://www.emanueleferonato.com/2009/03/19/magormin-an-old-php-based-game/</link>
		<comments>http://www.emanueleferonato.com/2009/03/19/magormin-an-old-php-based-game/#comments</comments>
		<pubDate>Thu, 19 Mar 2009 12:17:40 +0000</pubDate>
		<dc:creator>Emanuele Feronato</dc:creator>
				<category><![CDATA[Css]]></category>
		<category><![CDATA[Game design]]></category>
		<category><![CDATA[Html]]></category>
		<category><![CDATA[Php]]></category>

		<guid isPermaLink="false">http://www.emanueleferonato.com/?p=1081</guid>
		<description><![CDATA[This is an ooooooold (let&#8217;s call it) game I explained for a web programming class in 2003 or 2004. It was made to explain some basics about Php, sessions, MySql and styles. All in one. That&#8217;s how students learn&#8230; all in one and with a real world example. It&#8217;s just a &#8220;guess if next number [...]]]></description>
			<content:encoded><![CDATA[<p>This is an ooooooold (let&#8217;s call it) game I explained for a web programming class in 2003 or 2004.</p>
<p>It was made to explain some basics about Php, sessions, MySql and styles. All in one.</p>
<p>That&#8217;s how students learn&#8230; all in one and with a real world example.</p>
<p>It&#8217;s just a &#8220;guess if next number will be higher or slower than the current one&#8221; concept, the same that I applied to <a href="http://www.emanueleferonato.com/2007/12/30/guessnext-complete-flash-game-with-highscores/">GuessNext</a> last year.</p>
<p>It&#8217;s called <strong><a target = "_blank" href="http://www.gamemummy.com/magormin/">MagOrMin</a></strong> and the name comes from the italian translation of &#8220;higher&#8221; (maggiore) and &#8220;lower&#8221; (minore).</p>
<p><a target = "_blank" href="http://www.gamemummy.com/magormin/"><img src="/images/magormin.jpg" alt="MagOrMin" /></a></p>
<p>Simply click to say if next number will be higher or lower, gain extra lives and compete for the high scores.</p>
<p>I plan to port the game in Ajax, adding a so-called &#8220;Web 2.0&#8243; style and convert it into a Facebook application with all features&#8230; you know&#8230; I must monetize everything&#8230;</p>
<p>Meanwhile here it is the source code:<span id="more-1081"></span></p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
&nbsp;
<span style="color: #990000;">session_register</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;game_status&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #990000;">session_register</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;actual_number&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #990000;">session_register</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;score&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #990000;">session_register</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;lives&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #990000;">session_register</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;next_extra&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000088;">$connection</span> <span style="color: #339933;">=</span> <span style="color: #990000;">mysql_connect</span><span style="color: #009900;">&#40;</span>localhost<span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;****&quot;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;****&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$db</span><span style="color: #339933;">=</span> <span style="color: #990000;">mysql_select_db</span><span style="color: #009900;">&#40;</span><span style="color: #339933;">*****,</span><span style="color: #000088;">$connection</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000088;">$old_number</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$actual_number</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$actual_number</span> <span style="color: #339933;">=</span> <span style="color: #990000;">rand</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">0</span><span style="color: #339933;">,</span><span style="color: #cc66cc;">9</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
&nbsp;
<span style="color: #000088;">$page_name</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$PHP_SELF</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$guess</span> <span style="color: #339933;">==</span> <span style="color: #0000ff;">&quot;new&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
	<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_POST</span><span style="color: #009900;">&#91;</span>name<span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
		<span style="color: #000088;">$_POST</span><span style="color: #009900;">&#91;</span>name<span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #990000;">substr</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">strip_tags</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_POST</span><span style="color: #009900;">&#91;</span>name<span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span><span style="color: #cc66cc;">0</span><span style="color: #339933;">,</span><span style="color: #cc66cc;">20</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #000088;">$sql</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;insert into ****(***,***) values(<span style="color: #000099; font-weight: bold;">\&quot;</span>&quot;</span><span style="color: #339933;">.</span><span style="color: #990000;">stripslashes</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_POST</span><span style="color: #009900;">&#91;</span>name<span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;<span style="color: #000099; font-weight: bold;">\&quot;</span>,<span style="color: #006699; font-weight: bold;">$score</span>)&quot;</span><span style="color: #339933;">;</span>
		<span style="color: #000088;">$result</span> <span style="color: #339933;">=</span> <span style="color: #990000;">mysql_query</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$sql</span><span style="color: #339933;">,</span><span style="color: #000088;">$connection</span><span style="color: #009900;">&#41;</span> or <span style="color: #990000;">die</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$sql</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
	<span style="color: #000088;">$game_status</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;NOT_PLAYING&quot;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span><span style="color: #990000;">isset</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$game_status</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
	<span style="color: #000088;">$game_status</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;NOT_PLAYING&quot;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$game_status</span> <span style="color: #339933;">==</span> <span style="color: #0000ff;">&quot;NOT_PLAYING&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
	<span style="color: #000088;">$lives</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">3</span><span style="color: #339933;">;</span>
	<span style="color: #000088;">$score</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span>
	<span style="color: #000088;">$next_extra</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">3</span><span style="color: #339933;">;</span>
	<span style="color: #000088;">$class_to_show</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;number&quot;</span><span style="color: #339933;">;</span>
	<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$guess</span><span style="color: #339933;">==</span><span style="color: #0000ff;">&quot;bigger&quot;</span><span style="color: #009900;">&#41;</span>or<span style="color: #009900;">&#40;</span><span style="color: #000088;">$guess</span><span style="color: #339933;">==</span><span style="color: #0000ff;">&quot;smaller&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
		<span style="color: #000088;">$game_status</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;PLAYING&quot;</span><span style="color: #339933;">;</span>
		<span style="color: #000088;">$sql</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;update *** set *** = ***+ 1&quot;</span><span style="color: #339933;">;</span>
		<span style="color: #000088;">$result</span> <span style="color: #339933;">=</span> <span style="color: #990000;">mysql_query</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$sql</span><span style="color: #339933;">,</span><span style="color: #000088;">$connection</span><span style="color: #009900;">&#41;</span> or <span style="color: #990000;">die</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$sql</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #666666; font-style: italic;">//	echo $sql;</span>
	<span style="color: #009900;">&#125;</span>
	<span style="color: #b1b100;">else</span><span style="color: #009900;">&#123;</span>
		<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">isset</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$old_number</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
			<span style="color: #000088;">$actual_number</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$old_number</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span>
	<span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$game_status</span> <span style="color: #339933;">==</span> <span style="color: #0000ff;">&quot;PLAYING&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
	<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$guess</span> <span style="color: #339933;">==</span> <span style="color: #0000ff;">&quot;bigger&quot;</span><span style="color: #009900;">&#41;</span> and <span style="color: #009900;">&#40;</span><span style="color: #000088;">$actual_number</span> <span style="color: #339933;">&gt;=</span> <span style="color: #000088;">$old_number</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> or <span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$guess</span> <span style="color: #339933;">==</span> <span style="color: #0000ff;">&quot;smaller&quot;</span><span style="color: #009900;">&#41;</span> and <span style="color: #009900;">&#40;</span><span style="color: #000088;">$actual_number</span> <span style="color: #339933;">&lt;=</span> <span style="color: #000088;">$old_number</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
		<span style="color: #000088;">$score</span> <span style="color: #339933;">++;</span>
		<span style="color: #000088;">$class_to_show</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;number&quot;</span><span style="color: #339933;">;</span>
		<span style="color: #000088;">$game_status</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;PLAYING&quot;</span><span style="color: #339933;">;</span>
		<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$score</span> <span style="color: #339933;">==</span> <span style="color: #000088;">$next_extra</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
			<span style="color: #000088;">$lives</span> <span style="color: #339933;">+=</span><span style="color: #cc66cc;">1</span><span style="color: #339933;">;</span>
			<span style="color: #000088;">$next_extra</span> <span style="color: #339933;">=</span> <span style="color: #990000;">floor</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$next_extra</span><span style="color: #339933;">*</span><span style="color:#800080;">1.5</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span>
	<span style="color: #009900;">&#125;</span>
	<span style="color: #b1b100;">else</span><span style="color: #009900;">&#123;</span>
		<span style="color: #000088;">$lives</span> <span style="color: #339933;">-=</span><span style="color: #cc66cc;">1</span><span style="color: #339933;">;</span>
		<span style="color: #000088;">$class_to_show</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;number_wrong&quot;</span><span style="color: #339933;">;</span>
		<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$lives</span><span style="color: #339933;">==</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
			<span style="color: #000088;">$game_status</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;GAME_OVER&quot;</span><span style="color: #339933;">;</span>
			<span style="color: #000088;">$perso_ora</span> <span style="color: #339933;">=</span> <span style="color: #009900; font-weight: bold;">true</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span>
	<span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$game_status</span> <span style="color: #339933;">==</span> <span style="color: #0000ff;">&quot;GAME_OVER&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
	<span style="color: #000088;">$class_to_show</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;number_wrong&quot;</span><span style="color: #339933;">;</span>
	<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span><span style="color: #000088;">$perso_ora</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
		<span style="color: #000088;">$actual_number</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$old_number</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">//echo $game_status;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">?&gt;</span>
&nbsp;
&lt;html&gt;
&lt;head&gt;
&lt;style&gt;
&nbsp;
h1{
	color:#c4c41f;
	font-size: 20;
}
&nbsp;
.container{
	background-color: #000000;
	padding: 30px;
	border: 2px solid #c43d1f;
	width: 600px;
	height: 450px;
	font-family: verdana;
	font-size: 12px;
	color:c43d1f;
	font-weight: bold;
	text-align:center;
}
&nbsp;
.number{
	color:579331;
	font-family: verdana;
	font-size: 128px;
	border: 1px solid #c43d1f;
	margin-left: 140px;
	margin-right: 140px;
	margin-top: 15px;
	margin-bottom: 15px;
	background-color:#ffffff;
}
&nbsp;
.number_wrong{
	color:#c43d1f;
	font-family: verdana;
	font-size: 128px;
	border: 1px solid #c43d1f;
	margin-left: 140px;
	margin-right: 140px;
	margin-top: 15px;
	margin-bottom: 15px;
	background-color:#ffffff;
}
&nbsp;
a:link,a:visited{
	padding: 10px;
	margin: 15px;
	border: 1px dotted #c43d1f;
	width = 130px;
	text-align:center;
	text-decoration:none;
	font-size: 18;
	color:#579331;
}
&nbsp;
.score{
	padding: 5px;
	margin: 10px;
	border: 1px solid #c43d1f;
	text-align:center;
	font-size: 15;
	color:#c4c41f;
}
&nbsp;
a:hover{
	padding: 10px;
	margin: 15px;
	border: 1px dotted #c43d1f;
	width = 130px;
	text-align:center;
	text-decoration:none;
	background-color:#ffffff;
	font-size: 18;
	color:579331;
}
&nbsp;
ul
{
	padding-left: 0;
	margin-left: 0;
	float: left;
	width: 100%;
}
&nbsp;
&nbsp;
li{
	display: inline;
}
&nbsp;
body{
	font-family: sans-serif;
	text-align:center;
	background-color:#cccccc;
}
&nbsp;
&lt;/style&gt;
&lt;/head&gt;
&lt;body onload = &quot;self.focus()&quot;&gt;
&lt;div class = &quot;container&quot;&gt;
&lt;h1&gt;WELCOME TO PHP-MAGORMIN v1.0&lt;/h1&gt;
<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">&quot;&lt;ul&gt;&lt;li class =<span style="color: #000099; font-weight: bold;">\&quot;</span>score<span style="color: #000099; font-weight: bold;">\&quot;</span>&gt;Score: <span style="color: #006699; font-weight: bold;">$score</span>&lt;li class = <span style="color: #000099; font-weight: bold;">\&quot;</span>score<span style="color: #000099; font-weight: bold;">\&quot;</span>&gt;Lives: <span style="color: #006699; font-weight: bold;">$lives</span>&lt;li class = <span style="color: #000099; font-weight: bold;">\&quot;</span>score<span style="color: #000099; font-weight: bold;">\&quot;</span>&gt;Extra life at <span style="color: #006699; font-weight: bold;">$next_extra</span>&lt;/ul&gt;&quot;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
&lt;br&gt;&lt;br&gt;CURRENT NUMBER
&lt;div class = &quot;<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">echo</span> <span style="color: #000088;">$class_to_show</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&quot;&gt;<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">echo</span> <span style="color: #000088;">$actual_number</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&lt;/div&gt;
<span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$game_status</span> <span style="color: #339933;">==</span> <span style="color: #0000ff;">&quot;PLAYING&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span>
I guess next number will be
&lt;ul&gt;&lt;li&gt;&lt;a href = &quot;<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">echo</span> <span style="color: #000088;">$page_name</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>?guess=smaller&quot;&gt;SMALLER&lt;/a&gt;&lt;li&gt;&lt;a href = &quot;<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">echo</span> <span style="color: #000088;">$page_name</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>?guess=bigger&quot;&gt;BIGGER&lt;/a&gt;&lt;/ul&gt;
<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #009900;">&#125;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
<span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$game_status</span> <span style="color: #339933;">==</span> <span style="color: #0000ff;">&quot;GAME_OVER&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span>
GAME OVER&lt;br&gt;
&lt;form action = &quot;&quot; method = &quot;post&quot;&gt;Enter your name: &lt;input name = &quot;name&quot; type = &quot;text&quot;&gt;&lt;input type = &quot;hidden&quot; name =&quot;guess&quot; value = &quot;new&quot;&gt; &lt;input type = &quot;submit&quot; value = &quot;go&quot;&gt;&lt;/form&gt;
<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #009900;">&#125;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
<span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$game_status</span> <span style="color: #339933;">==</span> <span style="color: #0000ff;">&quot;NOT_PLAYING&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span>
I guess next number will be
&lt;ul&gt;&lt;li&gt;&lt;a href = &quot;<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">echo</span> <span style="color: #000088;">$page_name</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>?guess=smaller&quot;&gt;SMALLER&lt;/a&gt;&lt;li&gt;&lt;a href = &quot;<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">echo</span> <span style="color: #000088;">$page_name</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>?guess=bigger&quot;&gt;BIGGER&lt;/a&gt;&lt;/ul&gt;
&nbsp;
<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #009900;">&#125;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
&nbsp;
&lt;/div&gt;
&lt;/body&gt;
&lt;/html&gt;</pre></td></tr></table></div>

<p>I&#8217;ll explain the entire process to convert it into a Facebook app.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.emanueleferonato.com/2009/03/19/magormin-an-old-php-based-game/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Create a Lightbox effect only with CSS &#8211; no javascript needed</title>
		<link>http://www.emanueleferonato.com/2007/08/22/create-a-lightbox-effect-only-with-css-no-javascript-needed/</link>
		<comments>http://www.emanueleferonato.com/2007/08/22/create-a-lightbox-effect-only-with-css-no-javascript-needed/#comments</comments>
		<pubDate>Wed, 22 Aug 2007 16:23:11 +0000</pubDate>
		<dc:creator>Emanuele Feronato</dc:creator>
				<category><![CDATA[Css]]></category>

		<guid isPermaLink="false">http://www.emanueleferonato.com/2007/08/22/create-a-lightbox-effect-only-with-css-no-javascript-needed/</guid>
		<description><![CDATA[You may call it Lightbox, or Greybox, or Thickbox, but it&#8217;s always the same effect. When you are on a page, and click on a photo or trig some event, a Lightbox is an effect that fades the pagein the background to show you new content in the foreground. I mean this effect In the [...]]]></description>
			<content:encoded><![CDATA[<p>You may call it Lightbox, or Greybox, or Thickbox, but it&#8217;s always the same effect.</p>
<p>When you are on a page, and click on a photo or trig some event, a Lightbox is an effect that fades the pagein the background to show you new content in the foreground.</p>
<p>I mean this effect</p>
<p><img src="/images/lightbox.jpg" alt="Lightbox" /></p>
<p>In the upper example, when clicking on a photo the site fades to black and shows the photo, in the lower one when clicking on &#8220;login&#8221; the site fades to white and shows the login form.</p>
<p>There are tons of Lightbox scripts in the web, each one with its unique features and limitations, but all require massive use of Javascript or the installation of javascript frameworks.</p>
<p>In some cases, there are &#8220;lightweight&#8221; versions with &#8220;only&#8221; 40KB of Javascript.</p>
<p>This example does not want to compete with those scripts, but if you are looking for a simple, 100% CSS, 0% javascript lightbox, this may help you.</p>
<p>Features of this Lightbox:</p>
<p>100% CSS as said<br />
You can insert any content in it (some scripts out there only allow images) and easily upload your codes to your <a target = "_blank" href="http://www.webhostingsearch.com/">web hosting provider</a>.<span id="more-122"></span></p>
<p>That&#8217;s all. Did you need something more? Think wisely&#8230;</p>
<p>Let&#8217;s start with the CSS</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
</pre></td><td class="code"><pre class="css" style="font-family:monospace;">.black_overlay<span style="color: #00AA00;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">display</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">none</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">position</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">absolute</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">top</span><span style="color: #00AA00;">:</span> <span style="color: #933;">0%</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">left</span><span style="color: #00AA00;">:</span> <span style="color: #933;">0%</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">width</span><span style="color: #00AA00;">:</span> <span style="color: #933;">100%</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">height</span><span style="color: #00AA00;">:</span> <span style="color: #933;">100%</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">background-color</span><span style="color: #00AA00;">:</span> <span style="color: #000000; font-weight: bold;">black</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">z-index</span><span style="color: #00AA00;">:</span><span style="color: #cc66cc;">1001</span><span style="color: #00AA00;">;</span>
	-moz-opacity<span style="color: #00AA00;">:</span> <span style="color: #cc66cc;">0.8</span><span style="color: #00AA00;">;</span>
	opacity<span style="color: #00AA00;">:</span>.80<span style="color: #00AA00;">;</span>
	filter<span style="color: #00AA00;">:</span> alpha<span style="color: #00AA00;">&#40;</span>opacity<span style="color: #00AA00;">=</span><span style="color: #cc66cc;">80</span><span style="color: #00AA00;">&#41;</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span>
&nbsp;
<span style="color: #6666ff;">.white_content</span> <span style="color: #00AA00;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">display</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">none</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">position</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">absolute</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">top</span><span style="color: #00AA00;">:</span> <span style="color: #933;">25%</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">left</span><span style="color: #00AA00;">:</span> <span style="color: #933;">25%</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">width</span><span style="color: #00AA00;">:</span> <span style="color: #933;">50%</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">height</span><span style="color: #00AA00;">:</span> <span style="color: #933;">50%</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">padding</span><span style="color: #00AA00;">:</span> <span style="color: #933;">16px</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">border</span><span style="color: #00AA00;">:</span> <span style="color: #933;">16px</span> <span style="color: #993333;">solid</span> orange<span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">background-color</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">white</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">z-index</span><span style="color: #00AA00;">:</span><span style="color: #cc66cc;">1002</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">overflow</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">auto</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span></pre></td></tr></table></div>

<p>The <strong>black_overlay</strong> class is the layer that will make the web page seem to fade. It&#8217;s a black 80% opaque background as long and wide as the browser that will overlay the web page (look at the z-index) and at the moment is not shown (look at the display).</p>
<p>The <strong>white content</strong> class is the layer with the photo/login screen/whatever you want to appear in the Lightbox overlay. It&#8217;s a white layer to be placed over the black_overlay layer (look at the z-index, greater than the black_overlay one). The overflow allows you to have a scrollable content.</p>
<p>In the html file, put this line just before the <code></body></code> tag</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="html" style="font-family:monospace;">&lt;div id=&quot;light&quot; class=&quot;white_content&quot;&gt;Hi, I am an happy lightbox&lt;/div&gt;&lt;div id=&quot;fade&quot; class=&quot;black_overlay&quot;&gt;&lt;/div&gt;</pre></td></tr></table></div>

<p>Now, trig the action you want to open the Lightbox and insert this code:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="html" style="font-family:monospace;">document.getElementById('light').style.display='block';document.getElementById('fade').style.display='block';</pre></td></tr></table></div>

<p>For example, in a link would be:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="html" style="font-family:monospace;">&lt;a href = &quot;javascript:void(0)&quot; onclick = &quot;document.getElementById('light').style.display='block';document.getElementById('fade').style.display='block'&quot;&gt;Click me&lt;/a&gt;</pre></td></tr></table></div>

<p>Remember to include in the lightbox the code to close it, for example</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="html" style="font-family:monospace;">&lt;a href = &quot;javascript:void(0)&quot; onclick = &quot;document.getElementById('light').style.display='none';document.getElementById('fade').style.display='none'&quot;&gt;Hide me&lt;/a&gt;</pre></td></tr></table></div>

<p>A complete example page could be</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
</pre></td><td class="code"><pre class="html" style="font-family:monospace;">&lt;!DOCTYPE html PUBLIC &quot;-//W3C//DTD HTML 4.01 Transitional//EN&quot;&gt;
&lt;html&gt;
	&lt;head&gt;
		&lt;title&gt;LIGHTBOX EXAMPLE&lt;/title&gt;
		&lt;style&gt;
		.black_overlay{
			display: none;
			position: absolute;
			top: 0%;
			left: 0%;
			width: 100%;
			height: 100%;
			background-color: black;
			z-index:1001;
			-moz-opacity: 0.8;
			opacity:.80;
			filter: alpha(opacity=80);
		}
		.white_content {
			display: none;
			position: absolute;
			top: 25%;
			left: 25%;
			width: 50%;
			height: 50%;
			padding: 16px;
			border: 16px solid orange;
			background-color: white;
			z-index:1002;
			overflow: auto;
		}
	&lt;/style&gt;
	&lt;/head&gt;
	&lt;body&gt;
		&lt;p&gt;This is the main content. To display a lightbox click &lt;a href = &quot;javascript:void(0)&quot; onclick = &quot;document.getElementById('light').style.display='block';document.getElementById('fade').style.display='block'&quot;&gt;here&lt;/a&gt;&lt;/p&gt;
		&lt;div id=&quot;light&quot; class=&quot;white_content&quot;&gt;This is the lightbox content. &lt;a href = &quot;javascript:void(0)&quot; onclick = &quot;document.getElementById('light').style.display='none';document.getElementById('fade').style.display='none'&quot;&gt;Close&lt;/a&gt;&lt;/div&gt;
		&lt;div id=&quot;fade&quot; class=&quot;black_overlay&quot;&gt;&lt;/div&gt;
	&lt;/body&gt;
&lt;/html&gt;</pre></td></tr></table></div>

<p>That you can find up and running <a href="/downloads/lightbox.html" target = "_blank">in this page</a>.</p>
<p>In this example everything is static and preloaded, but you can easily add some php/ajax code to make it more dynamic while keeping the effect 100% CSS based.</p>
<p>Hope you will find it useful, should you use it in one of your works send me a comment and I&#8217;ll feature your site as example.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.emanueleferonato.com/2007/08/22/create-a-lightbox-effect-only-with-css-no-javascript-needed/feed/</wfw:commentRss>
		<slash:comments>496</slash:comments>
		</item>
		<item>
		<title>Managing crossbrowser opacity with CSS</title>
		<link>http://www.emanueleferonato.com/2006/08/05/managing-crossbrowser-opacity-with-css/</link>
		<comments>http://www.emanueleferonato.com/2006/08/05/managing-crossbrowser-opacity-with-css/#comments</comments>
		<pubDate>Sat, 05 Aug 2006 16:45:00 +0000</pubDate>
		<dc:creator>Emanuele Feronato</dc:creator>
				<category><![CDATA[Css]]></category>

		<guid isPermaLink="false">http://www.emanueleferonato.com/2006/08/05/managing-crossbrowser-opacity-with-css/</guid>
		<description><![CDATA[Sometimes you may want to change the opacity of some images with CSS. There are different ways to do it, according to the browser you are using. In this example, we&#8217;ll see both Explorer and Firefox. Firefox In Firefox, the style is -moz opacity: xx where xx is a number from 0 to 1, where [...]]]></description>
			<content:encoded><![CDATA[<p>Sometimes you may want to change the opacity of some images with CSS.<br />
There are different ways to do it, according to the browser you are using. In this example, we&#8217;ll see both Explorer and Firefox.</p>
<p><strong>Firefox</strong></p>
<p>In Firefox, the style is <em>-moz opacity: xx</em> where xx is a number from 0 to 1, where lesser equates to more transparency (basically, it&#8217;s the alpha).</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="html" style="font-family:monospace;">&lt;img style=&quot;-moz-opacity:0.5&quot; src=&quot;/images/google_logo.gif&quot;&gt;</pre></td></tr></table></div>

<p><img style="-moz-opacity:0.5" src="/images/google_logo.gif"></p>
<p>The above image should look solid in Explorer and 50% transparent in Firefox.</p>
<p><strong>Explorer</strong></p>
<p>In Explorer, the style is <em>filter: alpha(opacity=xx)</em> where xx is a number between 0 and 100 (again, it&#8217;s the alpha)</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="html" style="font-family:monospace;">&lt;img style=&quot;filter: alpha(opacity=50)&quot; src=&quot;/images/google_logo.gif&quot;&gt;</pre></td></tr></table></div>

<p><img style="filter: alpha(opacity=50)" src="/images/google_logo.gif"></p>
<p>The above image should look solid in Firefox and 50% transparent in Explorer.</p>
<p><strong>Firefox and Explorer</strong></p>
<p>To create an image with transparency both in Firefox and Explorer, you need to use both styles</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="html" style="font-family:monospace;">&lt;img style=&quot;filter: alpha(opacity=50); -moz-opacity:0.5&quot; src=&quot;/images/google_logo.gif&quot;&gt;</pre></td></tr></table></div>

<p><img style="filter: alpha(opacity=50); -moz-opacity:0.5" src="/images/google_logo.gif"></p>
<p>This image should look 50% transparent in Explorer and in Firefox.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.emanueleferonato.com/2006/08/05/managing-crossbrowser-opacity-with-css/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Enhanced country selection with Css and Javascript</title>
		<link>http://www.emanueleferonato.com/2006/07/23/enhanced-country-selection-with-css-and-javascript/</link>
		<comments>http://www.emanueleferonato.com/2006/07/23/enhanced-country-selection-with-css-and-javascript/#comments</comments>
		<pubDate>Sun, 23 Jul 2006 14:14:03 +0000</pubDate>
		<dc:creator>Emanuele Feronato</dc:creator>
				<category><![CDATA[Css]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[Tutorials]]></category>

		<guid isPermaLink="false">http://www.emanueleferonato.com/2006/07/23/enhanced-country-selection-with-css-and-javascript/</guid>
		<description><![CDATA[How many times you had to choose your country in a form, with a old, simple popup? Time to change the way you choose your country (or anything else) with a bit of Css and Javascript. I am showing the example in a iframe not to mess with WordPress styles. As you can see, when [...]]]></description>
			<content:encoded><![CDATA[<p>How many times you had to choose your country in a form, with a old, simple popup?</p>
<p>Time to change the way you choose your country (or anything else) with a bit of Css and Javascript.</p>
<p>I am showing the example in a iframe not to mess with WordPress styles.</p>
<p><iframe src="/downloads/flags/flags.html" frameborder="1" scrolling="no" height="200" width="500"></iframe></p>
<p>As you can see, when you move the mouse over the text input, a list with (almost) every world country and flag appears, and when you click on a country, its ISO code is displayed into the text input.<br />
When you move the mouse out of the country list, it closes.</p>
<p>How can it be made?<span id="more-23"></span></p>
<p>Let&#8217; see the content of the main page</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
</pre></td><td class="code"><pre class="html" style="font-family:monospace;">&lt;html&gt;
&lt;head&gt;
&lt;meta http-equiv=&quot;content-type&quot; content=&quot;text/html; charset=iso-8859-1&quot;&gt;
&lt;style type=&quot;text/css&quot;&gt;
body{margin:0px;font-family:verdana;font-size:11px;background-color:#e5e5e5}
a{
	position:relative;
	z-index:24;
}
a:hover{
	z-index: 25; 
	background-color: #ff0}
a span{
	display: none
}
a:hover span{
	display: block;
	position:absolute;
    top: 10px;
    left: 20px;
    width: 200px;
    border: 1px solid #000000;
}
&nbsp;
input{
	width:30px;
	font-family:verdana
}
&nbsp;
&lt;/style&gt;
&lt;/head&gt;
&lt;body&gt;
	&lt;form id=&quot;countrysel&quot; method=&quot;get&quot; name=&quot;countrysel&quot;&gt;
		Select country: &lt;a href=&quot;javascript:void(0)&quot;&gt;&lt;input type=&quot;text&quot; name=&quot;country&quot; readonly&gt;&lt;span&gt;&lt;iframe src=&quot;index.html&quot; frameborder=&quot;0&quot; scrolling=&quot;yes&quot; height=&quot;150&quot; width=&quot;220&quot;&gt;&lt;/iframe&gt;&lt;/span&gt;&lt;/a&gt;
	&lt;/form&gt;
	other content here other content here other content here
&lt;/body&gt;
&lt;/html&gt;</pre></td></tr></table></div>

<p>The trick is in the &lt;a&gt; and &lt;span&gt; css use, with a <em>display</em> attribute changing on <em>hover</em> status.</p>
<p>It&#8217;s easiest to see than to explain.</p>
<p>Let&#8217;s look at line 34, when I call the <em>iframe</em> I simply load an ordered list with a javascript to communicate with the &#8220;parent&#8221; page.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
</pre></td><td class="code"><pre class="html" style="font-family:monospace;">&lt;html&gt;
&lt;head&gt;
&lt;meta http-equiv=&quot;content-type&quot; content=&quot;text/html;charset=iso-8859-1&quot; /&gt;
&lt;style type=&quot;text/css&quot;&gt;
body{margin:0px;background-color: #000000}
ul{margin:0px;padding:0px;margin-left: 1px;padding-left: 0;list-style-type: none;font-family: verdana;font-size:11px;text-transform: capitalize;}
img{ vertical-align: middle}
a{display: block;width: 200px;background-color: #f5f5f5;padding:4px;}
a:link, a:visited{color: #000000;text-decoration: none;}
a:hover{background-color: #ffaf2e;color: #000000;font-weight:bold;}
&lt;/style&gt;
&lt;/head&gt;
&lt;body&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href = &quot;javascript:void(0)&quot; onclick = &quot;parent.document.countrysel.country.value = 'af'&quot;&gt;&lt;img src=&quot;af.gif&quot; alt=&quot;&quot; width=&quot;16&quot; height=&quot;11&quot; border=&quot;0&quot; /&gt; afghanistan&lt;/a&gt;
&lt;li&gt;&lt;a href = &quot;javascript:void(0)&quot; onclick = &quot;parent.document.countrysel.country.value = 'ax'&quot;&gt;&lt;img src=&quot;ax.gif&quot; alt=&quot;&quot; width=&quot;16&quot; height=&quot;11&quot; border=&quot;0&quot; /&gt; &amp;aring;land islands&lt;/a&gt;
&lt;li&gt;&lt;a href = &quot;javascript:void(0)&quot; onclick = &quot;parent.document.countrysel.country.value = 'al'&quot;&gt;&lt;img src=&quot;al.gif&quot; alt=&quot;&quot; width=&quot;16&quot; height=&quot;11&quot; border=&quot;0&quot; /&gt; albania&lt;/a&gt;
...
...</pre></td></tr></table></div>

<p>Look how I set the menu starting with an unordered list with Css (lines 5-10) and how I pass ISO values to the parent page (line 15 for example).</p>
<p>You can download the whole work <a href="/downloads/flags.zip">here</a>, check 2 html files and give me feedback or suggestion about the use of this feature.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.emanueleferonato.com/2006/07/23/enhanced-country-selection-with-css-and-javascript/feed/</wfw:commentRss>
		<slash:comments>12</slash:comments>
		</item>
		<item>
		<title>Submit button &#8220;inspired&#8221; to Macromedia Buttons</title>
		<link>http://www.emanueleferonato.com/2006/06/13/submit-button-inspired-to-macromedia-buttons/</link>
		<comments>http://www.emanueleferonato.com/2006/06/13/submit-button-inspired-to-macromedia-buttons/#comments</comments>
		<pubDate>Tue, 13 Jun 2006 20:41:44 +0000</pubDate>
		<dc:creator>Emanuele Feronato</dc:creator>
				<category><![CDATA[Css]]></category>

		<guid isPermaLink="false">http://www.emanueleferonato.com/2006/06/13/submit-button-inspired-to-macromedia-buttons/</guid>
		<description><![CDATA[I like very much Macromedia buttons, and I wanted to have it one like these in my forms. That&#8217;s all&#8230; here it is the style is 1 &#60;input style=&#34;width: 120px; border: 3px double #999999; border-top-color: #CCCCCC; border-left-color: #CCCCCC; padding: 4px; background-color: #EEEEEE; background-repeat: repeat-x; color: #333333; font-size: 11px; font-weight: bold; font-family: Verdana, Helvetica, Arial, sans-serif;&#34; [...]]]></description>
			<content:encoded><![CDATA[<p>I like very much Macromedia buttons, and I wanted to have it one like these in my forms.</p>
<p>That&#8217;s all&#8230; here it is</p>
<input style="width: 120px; border: 3px double #999999; border-top-color: #CCCCCC; border-left-color: #CCCCCC; padding: 4px; background-color: #EEEEEE; background-repeat: repeat-x; color: #333333; font-size: 11px; font-weight: bold; font-family: Verdana, Helvetica, Arial, sans-serif;" type="submit" value="Push me" />
<p>the style is</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="html" style="font-family:monospace;">&lt;input style=&quot;width: 120px; border: 3px double #999999; border-top-color: #CCCCCC; border-left-color: #CCCCCC; padding: 4px; background-color: #EEEEEE; background-repeat: repeat-x; color: #333333; font-size: 11px; font-weight: bold; font-family: Verdana, Helvetica, Arial, sans-serif;&quot; type=&quot;submit&quot; value=&quot;Push me&quot; /&gt;</pre></td></tr></table></div>

<p>Bye.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.emanueleferonato.com/2006/06/13/submit-button-inspired-to-macromedia-buttons/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
	</channel>
</rss>

<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Page Caching using disk: enhanced
Database Caching 10/18 queries in 0.191 seconds using disk: basic

Served from: www.emanueleferonato.com @ 2012-02-08 19:41:45 -->
