<?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>1stwebdesigner - Graphic and Web Design Blog &#187; Coding</title>
	<atom:link href="http://www.1stwebdesigner.com/category/css/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.1stwebdesigner.com</link>
	<description>1stwebdesigner is a design blog dedicated to bloggers, freelancers, web-developers and designers. Topics focus on web design and inspirational articles.</description>
	<lastBuildDate>Sun, 12 Feb 2012 13:09:13 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>jQuery Mobile &#8211; What You Need to Know</title>
		<link>http://www.1stwebdesigner.com/css/jquery-mobile-need-to-know/</link>
		<comments>http://www.1stwebdesigner.com/css/jquery-mobile-need-to-know/#comments</comments>
		<pubDate>Mon, 30 Jan 2012 10:00:22 +0000</pubDate>
		<dc:creator>Rochester Oliveira</dc:creator>
				<category><![CDATA[Coding]]></category>
		<category><![CDATA[JS & AJAX]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[jquery]]></category>
		<category><![CDATA[jquery mobile]]></category>
		<category><![CDATA[mobile site]]></category>
		<category><![CDATA[tutorial]]></category>
		<category><![CDATA[web mobile]]></category>

		<guid isPermaLink="false">http://www.1stwebdesigner.com/?p=60417</guid>
		<description><![CDATA[jQuery Mobile version 1.0 finally launched this past November. Don&#8217;t know if you heard about it, but if you are planning to do any mobile app or website development, it&#8217;s better to get started with it right now. I&#8217;m sure you&#8217;ve heard about jQuery. So, its mobile version is pretty close to what you already [...]]]></description>
			<content:encoded><![CDATA[<p>jQuery Mobile version 1.0 finally launched this past November. Don&#8217;t know if you heard about it, but if you are planning to do any mobile app or website development, it&#8217;s better to get started with it right now.</p>
<p>I&#8217;m sure you&#8217;ve heard about jQuery. So, its mobile version is pretty close to what you already are used to, but with a lot of enhancements for mobile screen events (like touching instead of click, and there is no hover) and browsers (this one is tricky since there are plenty of browsers and devices out there) and capabilities (pluggable components).</p>
<p>The crazy thing is how simple it is to initiate and build a fully working mobile site. Actually, we&#8217;ll be talking about concepts, tips, codes, and in the meantime you can build your own app, in no more than one hour. Yeah, noob to ninja in one hour, this is what you&#8217;ll get here :)</p>
<p>So, let&#8217;s rock!</p>
<p><span id="more-60417"></span></p>
<h2>jQuery Mobile&#8217;s Main Concept</h2>
<hr style="margin-left: 20px;" align="left" width="60%" />
<p><a href="http://jquerymobile.com/"><img class="alignnone size-full wp-image-62982" title="jquery-print" src="http://cdn1.1stwebdesigner.com/wp-content/uploads/2012/01/jquery-print.jpg" alt="" width="550" height="316" /></a></p>
<h3>Cross browsing, a nightmare that was coming back</h3>
<p>Those who used to code anything between 2001 and 2008 (while &lt; IE6 was pretty huge, and Firefox / Chrome were just the new kids on the browser block) faced the nightmare of cross-browser issues. I mean, if you think that putting a vendor prefix before CSS code is cross-browser, try to get things working well on IE5.5, IE6, Opera and Firefox without CSS / JS hacks.</p>
<p>That, dear Padawan, was crazy.</p>
<p>Back to 2010, mobile was getting bigger and bigger. So were the types of browsers out there. Each smart phone and tablet has its own capabilities and its own particularities. Try mixing that with touch oriented screens and a huge range of screen sizes. Sound familiar?</p>
<h2>Then, the hero arrives</h2>
<hr style="margin-left: 20px;" align="left" width="60%" />
<p><img class="alignnone size-full wp-image-62983" title="jquery-hero" src="http://cdn1.1stwebdesigner.com/wp-content/uploads/2012/01/jquery-hero.jpg" alt="" width="600" height="400" /></p>
<p>Credits: <a href="http://www.sxc.hu/photo/955075">bizior</a> (photo) &amp; Rochester Oliveira (edit)</p>
<p>jQuery Mobile comes with a huge compatibility table, with lots of devices and platforms well covered. All you&#8217;ve got to do is include their libraries, and try to stop your jaw from hitting the floor when you see the amazing features.</p>
<p>Oh, and it&#8217;s not just about cross browsing. It also covers a lot of UI elements that are already standards out there. And if you want a little more customized look you can easily change that, without messing up functionality.</p>
<h2>Awesomeness proven, let&#8217;s code!</h2>
<hr style="margin-left: 20px;" align="left" width="60%" />
<p>Ok, now you know why this project is so great, let&#8217;s take a look at some of the overall effects, components, good practices and code that you may want to use.</p>
<h2>Basic structure</h2>
<hr style="margin-left: 20px;" align="left" width="60%" />
<p>Just to get started, let&#8217;s grab our files from jQuery&#8217;s CDN. We&#8217;ll need just 3 files:</p>
<ul>
<li>jQuery Mobile stylesheet</li>
<li>jQuery JS</li>
<li>jQuery Mobile JS</li>
</ul>
<p>So your code will look like:</p>
<pre class="brush: php; title: ; notranslate">&lt;!DOCTYPE html&gt;
&lt;html&gt;
&lt;head&gt;
	&lt;title&gt;Starter page&lt;/title&gt;
	&lt;meta charset=&quot;utf-8&quot; /&gt;
    &lt;meta name=&quot;viewport&quot; content=&quot;width=device-width, initial-scale=1&quot; /&gt;
    &lt;meta http-equiv=&quot;X-UA-Compatible&quot; content=&quot;IE=edge,chrome=1&quot; /&gt;
	&lt;link rel=&quot;stylesheet&quot; href=&quot;http://code.jquery.com/mobile/1.0/jquery.mobile-1.0.min.css&quot; /&gt;
	&lt;script src=&quot;http://code.jquery.com/jquery-1.6.4.min.js&quot;&gt;&lt;/script&gt;
	&lt;script src=&quot;http://code.jquery.com/mobile/1.0/jquery.mobile-1.0.min.js&quot;&gt;&lt;/script&gt;
&lt;/head&gt;
&lt;body&gt;
	&lt;div data-role=&quot;page&quot; id=&quot;home&quot;&gt;
		&lt;div data-role=&quot;header&quot;&gt;
			&lt;h1&gt;Header&lt;/h1&gt;
		&lt;/div&gt;
		&lt;div data-role=&quot;content&quot;&gt;
			&lt;p&gt;Lorem ipsum&lt;/p&gt;
		&lt;/div&gt;
		&lt;div data-role=&quot;footer&quot;&gt;
			&lt;h4&gt;Footer&lt;/h4&gt;
		&lt;/div&gt;
	&lt;/div&gt;
&lt;/body&gt;
&lt;/html&gt;</pre>
<p>As you may notice it uses HTML5 markup and data-* attributes to get things working. This snippet will output this (all tests done with iOS 5.0.1 @ iPod):</p>
<p><img class="alignnone size-full wp-image-62985" title="screen-1" src="http://cdn1.1stwebdesigner.com/wp-content/uploads/2012/01/screen-1.jpg" alt="" width="550" height="367" /></p>
<p>Important note, any &#8220;traditional&#8221; jQuery call should be placed before the call for mobile framework.</p>
<h2>Basic UI components</h2>
<hr style="margin-left: 20px;" align="left" width="60%" />
<p>jQuery Mobile uses data-* attributes to define UI components. Actually you just saw 4 of them above. Let&#8217;s see a small list of them and their correspondent data attribute:</p>
<ul>
<li><strong>data-role=&#8221;page&#8221;</strong> : you can set divs inside your HTML page to behave as pages. SO what we&#8217;ve done above is to create a page &#8220;home&#8221; inside our file</li>
<li><strong>data-role=&#8221;header&#8221;:</strong> used to mark divs as top toolbars. You can set up data-position=&#8221;fixed&#8221; as well so it&#8217;ll behave as fixed toolbar</li>
<li><strong>data-role=&#8221;content&#8221;:</strong> the main part of your website / app. Images, buttons, actions and all the magic happens here!</li>
<li><strong>data-role=&#8221;footer&#8221;:</strong> defines a toolbar at the bottom of current page. May use data-position=&#8221;fixed&#8221; too so it&#8217;ll force to stay at the bottom of the screen</li>
<li><strong>data-role=&#8221;button&#8221;:</strong> it&#8217;ll be useful together with elements. You may use also data-transition to define how it&#8217;ll load next page. Options: slide, slideup, slidedown, pop, fade, flip. Another cool thing is data-icon, which gives you a <a href="http://jquerymobile.com/demos/1.0a4.1/docs/buttons/buttons-icons.html">lot of default icons</a>. You may also reduce its size using data-inline=&#8221;true&#8221;.</li>
<li><strong>data-theme=&#8221;a/b/c/d/e&#8221;:</strong> Define color scheme used for elements.</li>
</ul>
<p>Let&#8217;s wrap up all those attributes in a simple 2-page linking. Output:</p>
<p><img class="alignnone size-full wp-image-62984" title="screen-2" src="http://cdn1.1stwebdesigner.com/wp-content/uploads/2012/01/screen-2.jpg" alt="" width="550" height="367" /></p>
<p>Second page:</p>
<p><img class="alignnone size-full wp-image-62986" title="screen-3" src="http://cdn1.1stwebdesigner.com/wp-content/uploads/2012/01/screen-3.jpg" alt="" width="550" height="367" /></p>
<p>Code:</p>
<pre class="brush: php; title: ; notranslate">&lt;!DOCTYPE html&gt;
&lt;html&gt;
&lt;head&gt;
	&lt;title&gt;Starter page&lt;/title&gt;
	&lt;meta charset=&quot;utf-8&quot; /&gt;
    &lt;meta name=&quot;viewport&quot; content=&quot;width=device-width, initial-scale=1&quot; /&gt;
    &lt;meta http-equiv=&quot;X-UA-Compatible&quot; content=&quot;IE=edge,chrome=1&quot; /&gt;
	&lt;link rel=&quot;stylesheet&quot; href=&quot;http://code.jquery.com/mobile/1.0/jquery.mobile-1.0.min.css&quot; /&gt;
	&lt;script src=&quot;http://code.jquery.com/jquery-1.6.4.min.js&quot;&gt;&lt;/script&gt;
	&lt;script src=&quot;http://code.jquery.com/mobile/1.0/jquery.mobile-1.0.min.js&quot;&gt;&lt;/script&gt;
&lt;/head&gt;
&lt;body&gt;
	&lt;div data-role=&quot;page&quot; id=&quot;home&quot; data-theme=&quot;b&quot;&gt;
		&lt;div data-role=&quot;header&quot;&gt;
			&lt;h1&gt;Header&lt;/h1&gt;
		&lt;/div&gt;
		&lt;div data-role=&quot;content&quot;&gt;
			&lt;p&gt;Lorem ipsum&lt;/p&gt;
			 &lt;p&gt;&lt;a href=&quot;#second&quot; data-role=&quot;button&quot; data-transition=&quot;fade&quot; data-icon=&quot;arrow-r&quot; data-iconpos=&quot;right&quot;&gt;Second page&lt;/a&gt;&lt;/p&gt;
		&lt;/div&gt;
		&lt;div data-role=&quot;footer&quot;&gt;
			&lt;h4&gt;Footer&lt;/h4&gt;
		&lt;/div&gt;
	&lt;/div&gt;
	&lt;div data-role=&quot;page&quot; id=&quot;second&quot;&gt;
		&lt;div data-role=&quot;header&quot;&gt;
			&lt;h1&gt;Header second page&lt;/h1&gt;
		&lt;/div&gt;
		&lt;div data-role=&quot;content&quot;&gt;
			&lt;p&gt;I'm second page!&lt;/p&gt;
		&lt;/div&gt;
		&lt;div data-role=&quot;footer&quot;&gt;
			&lt;h4&gt;Footer second page&lt;/h4&gt;
		&lt;/div&gt;
	&lt;/div&gt;
&lt;/body&gt;
&lt;/html&gt;</pre>
<h2>Navigation, Lists, Form &amp; Dialog Components</h2>
<hr style="margin-left: 20px;" align="left" width="60%" />
<p>Then we have a bunch of other default components that are easily implemented with jQuery Mobile:</p>
<ul>
<li><strong>data-role=&#8221;navbar&#8221;:</strong> Used to create menus. Then you should place a ul item with li&#8217;s and a&#8217;s (BTW, that&#8217;s the way you should create menus, always)</li>
<li><strong>data-role=&#8221;listview&#8221; + data-filter=&#8221;true&#8221; :</strong> Awesomely easy way to create searchable lists. Really useful!</li>
<li><strong>data-role=&#8221;fieldcontain&#8221;:</strong> This is a container for form elements</li>
<li>select  data-native-menu=&#8221;false&#8221;: creates a cool select element as &#8220;floating&#8221; element instead of default select which stole half of screen area</li>
<li><strong>select  data-role=&#8221;slider&#8221;:</strong> Creates a &#8220;on / off&#8221; slider, useful for options pages</li>
<li><strong>input type=email, tel, number, url..:</strong> accepts any HTML5 data format, and adjust keyboard to better fit data type</li>
<li><strong>input type=range:</strong> same as before, but this one uses new HTML format and creates an actual slider, good for numbers range inputs</li>
<li><strong>data-rel=&#8221;dialog&#8221;:</strong> is an anchor attribute that makes target page opens as dialog box.</li>
<li><strong>data-add-back-btn=&#8221;true&#8221;:</strong> add this attribute to your page and you&#8217;ll have a &#8220;back&#8221; button. Cool, huh?</li>
</ul>
<p>Now we&#8217;ll edit our demo file a little bit. It&#8217;ll be 4 pages now:</p>
<ul>
<li>Home screen will have a dialog box</li>
<li>Form elements page will use all we have mentioned</li>
<li>List page will have a searchable list so you can try it</li>
<li>Alert page has target content when user clicks the alert link</li>
</ul>
<p>Previews:</p>
<p><img class="alignnone  wp-image-62987" title="screen-4" src="http://cdn1.1stwebdesigner.com/wp-content/uploads/2012/01/screen-4.jpg" alt="" width="334" height="500" /></p>
<p>Alert page:</p>
<p><img class="alignnone  wp-image-62988" title="screen-5" src="http://cdn1.1stwebdesigner.com/wp-content/uploads/2012/01/screen-5.jpg" alt="" width="333" height="500" /></p>
<p>Form page:</p>
<p><img class="alignnone  wp-image-62990" title="screen-7" src="http://cdn1.1stwebdesigner.com/wp-content/uploads/2012/01/screen-7.jpg" alt="" width="333" height="500" /></p>
<p>Lists page:</p>
<p><img class="alignnone  wp-image-62989" title="screen-6" src="http://cdn1.1stwebdesigner.com/wp-content/uploads/2012/01/screen-6.jpg" alt="" width="334" height="500" /></p>
<pre class="brush: php; title: ; notranslate">&lt;!DOCTYPE html&gt;
&lt;html&gt;
&lt;head&gt;
	&lt;title&gt;Starter page - 1stWebDesigner.com&lt;/title&gt;
	&lt;meta charset=&quot;utf-8&quot; /&gt;
    &lt;meta name=&quot;viewport&quot; content=&quot;width=device-width, initial-scale=1&quot; /&gt;
    &lt;meta http-equiv=&quot;X-UA-Compatible&quot; content=&quot;IE=edge,chrome=1&quot; /&gt;
	&lt;link rel=&quot;stylesheet&quot; href=&quot;http://code.jquery.com/mobile/1.0/jquery.mobile-1.0.min.css&quot; /&gt;
	&lt;script src=&quot;http://code.jquery.com/jquery-1.6.4.min.js&quot;&gt;&lt;/script&gt;
	&lt;script src=&quot;http://code.jquery.com/mobile/1.0/jquery.mobile-1.0.min.js&quot;&gt;&lt;/script&gt;
&lt;/head&gt;
&lt;body&gt;
	&lt;div data-role=&quot;page&quot; id=&quot;home&quot; data-add-back-btn=&quot;true&quot;&gt;
		&lt;div data-role=&quot;header&quot;&gt;
			&lt;h1&gt;Alert element&lt;/h1&gt;
		&lt;/div&gt;
		&lt;div data-role=&quot;content&quot;&gt;
			&lt;p&gt;&lt;a href=&quot;#alert&quot; data-role=&quot;button&quot; data-transition=&quot;fade&quot; data-icon=&quot;arrow-r&quot; data-iconpos=&quot;right&quot; data-theme=&quot;b&quot; data-rel=&quot;dialog&quot;&gt;Open alert&lt;/a&gt;&lt;/p&gt;
		&lt;/div&gt;
		&lt;div data-role=&quot;footer&quot;&gt;
			&lt;div data-role=&quot;navbar&quot;&gt;
				&lt;ul&gt;
					&lt;li&gt;&lt;a href=&quot;#form&quot; data-role=&quot;button&quot; data-transition=&quot;fade&quot; data-icon=&quot;arrow-r&quot; data-iconpos=&quot;right&quot; data-inline=&quot;true&quot;&gt;Form Elements&lt;/a&gt;&lt;/li&gt;
					&lt;li&gt;&lt;a href=&quot;#list&quot; data-role=&quot;button&quot; data-transition=&quot;fade&quot; data-icon=&quot;arrow-r&quot; data-iconpos=&quot;right&quot; data-inline=&quot;true&quot;&gt;List element&lt;/a&gt;&lt;/li&gt;
				&lt;/ul&gt;
			&lt;/div&gt;
		&lt;/div&gt;
	&lt;/div&gt;
	&lt;div data-role=&quot;page&quot; id=&quot;form&quot; data-add-back-btn=&quot;true&quot;&gt;
		&lt;div data-role=&quot;header&quot;&gt;
			&lt;h1&gt;Form elements&lt;/h1&gt;
		&lt;/div&gt;
		&lt;div data-role=&quot;content&quot;&gt;
			&lt;div data-role=&quot;fieldcontain&quot;&gt;
				&lt;label for=&quot;name&quot; class=&quot;select&quot;&gt;Choose:&lt;/label&gt;
				&lt;select id=&quot;name&quot; name=&quot;select&quot; data-native-menu=&quot;false&quot;&gt;
					&lt;option value=&quot;value1&quot;&gt;option1&lt;/option&gt;
					&lt;option value=&quot;value2&quot;&gt;option2&lt;/option&gt;
					&lt;option value=&quot;value3&quot;&gt;option3&lt;/option&gt;
				&lt;/select&gt;

				&lt;label for=&quot;slider&quot;&gt;Select slider:&lt;/label&gt;
				&lt;select name=&quot;slider&quot; id=&quot;slider&quot; data-role=&quot;slider&quot;&gt;
					&lt;option value=&quot;off&quot;&gt;Off&lt;/option&gt;
					&lt;option value=&quot;on&quot;&gt;On&lt;/option&gt;
				&lt;/select&gt;

				&lt;label for=&quot;slider&quot;&gt;Input slider:&lt;/label&gt;
				&lt;input type=&quot;range&quot; name=&quot;slider&quot; id=&quot;slider&quot; value=&quot;0&quot; min=&quot;0&quot; max=&quot;100&quot;  /&gt;

				&lt;label for=&quot;email&quot;&gt;Email Input:&lt;/label&gt;
				&lt;input type=&quot;email&quot; id=&quot;email&quot; name=&quot;email&quot; value=&quot;&quot;  /&gt;

				&lt;label for=&quot;num&quot;&gt;Number Input:&lt;/label&gt;
				&lt;input type=&quot;number&quot; id=&quot;num&quot; name=&quot;num&quot; value=&quot;&quot;  /&gt;
			&lt;/div&gt;
		&lt;/div&gt;
		&lt;div data-role=&quot;footer&quot;&gt;
			&lt;div data-role=&quot;navbar&quot;&gt;
				&lt;ul&gt;
					&lt;li&gt;&lt;a href=&quot;#home&quot; data-role=&quot;button&quot; data-transition=&quot;fade&quot; data-icon=&quot;arrow-r&quot; data-iconpos=&quot;right&quot; data-inline=&quot;true&quot;&gt;Home&lt;/a&gt;&lt;/li&gt;
					&lt;li&gt;&lt;a href=&quot;#list&quot; data-role=&quot;button&quot; data-transition=&quot;fade&quot; data-icon=&quot;arrow-r&quot; data-iconpos=&quot;right&quot; data-inline=&quot;true&quot;&gt;List element&lt;/a&gt;&lt;/li&gt;
				&lt;/ul&gt;
			&lt;/div&gt;
		&lt;/div&gt;
	&lt;/div&gt;
	&lt;div data-role=&quot;page&quot; id=&quot;list&quot; data-add-back-btn=&quot;true&quot;&gt;
		&lt;div data-role=&quot;header&quot;&gt;
			&lt;h1&gt;This is a list&lt;/h1&gt;
		&lt;/div&gt;
		&lt;div data-role=&quot;content&quot;&gt;
			&lt;ul data-role=&quot;listview&quot; data-filter=&quot;true&quot;&gt;
				&lt;li&gt;Lorem ipsum dolor sit amet, consectetur adipiscing elit.&lt;/li&gt;
				&lt;li&gt;Aliquam vitae leo metus, quis suscipit nulla.&lt;/li&gt;
				&lt;li&gt;Maecenas accumsan urna sit amet justo commodo accumsan.&lt;/li&gt;
				&lt;li&gt;Nulla vitae lacus augue, vel eleifend tellus.&lt;/li&gt;
				&lt;li&gt;Integer at ligula turpis, at fermentum nisl.&lt;/li&gt;
				&lt;li&gt;Nam dapibus risus at massa sagittis egestas.&lt;/li&gt;
				&lt;li&gt;Praesent hendrerit purus vitae enim faucibus tincidunt.&lt;/li&gt;
				&lt;li&gt;Curabitur sit amet lectus neque, id facilisis elit.&lt;/li&gt;
			&lt;/ul&gt;
		&lt;/div&gt;
		&lt;div data-role=&quot;footer&quot;&gt;
			&lt;div data-role=&quot;navbar&quot;&gt;
				&lt;ul&gt;
					&lt;li&gt;&lt;a href=&quot;#home&quot; data-role=&quot;button&quot; data-transition=&quot;fade&quot; data-icon=&quot;arrow-r&quot; data-iconpos=&quot;right&quot; data-inline=&quot;true&quot;&gt;Home&lt;/a&gt;&lt;/li&gt;
					&lt;li&gt;&lt;a href=&quot;#form&quot; data-role=&quot;button&quot; data-transition=&quot;fade&quot; data-icon=&quot;arrow-r&quot; data-iconpos=&quot;right&quot; data-inline=&quot;true&quot;&gt;Form element&lt;/a&gt;&lt;/li&gt;
				&lt;/ul&gt;
			&lt;/div&gt;
		&lt;/div&gt;
	&lt;/div&gt;
	&lt;div data-role=&quot;page&quot; id=&quot;alert&quot; data-add-back-btn=&quot;true&quot;&gt;
		&lt;div data-role=&quot;header&quot;&gt;
			&lt;h1&gt;Alert!&lt;/h1&gt;
		&lt;/div&gt;
		&lt;div data-role=&quot;content&quot;&gt;
			&lt;p&gt;I'm alert page!&lt;/p&gt;
		&lt;/div&gt;
	&lt;/div&gt;
&lt;/body&gt;
&lt;/html&gt;</pre>
<h2>Custom font embedding</h2>
<hr style="margin-left: 20px;" align="left" width="60%" />
<p>Probably no method will beat @font-face. So I suggest you go to <a href="http://www.fontsquirrel.com/fontface/generator">Font Squirrel</a> and generate your font files.</p>
<p><a href="http://www.fontsquirrel.com/fontface/generator"><img class="alignnone size-full wp-image-62991" title="font-squirrel" src="http://cdn1.1stwebdesigner.com/wp-content/uploads/2012/01/font-squirrel.jpg" alt="" width="550" height="461" /></a></p>
<h2>Compress images</h2>
<hr style="margin-left: 20px;" align="left" width="60%" />
<p>You should do this all the time, actually. But when you are designing for the mobile world, even a few kb&#8217;s makes big difference. So save your user&#8217;s bandwidth and compress not only your code, but all your images.</p>
<p><a href="http://www.jpegmini.com/main/home">JPEG mini</a> has the best compressing service I&#8217;ve ever seen, and it&#8217;s quite easy to use, you should give it a try!</p>
<p><a href="http://www.jpegmini.com/main/home"><img class="alignnone size-full wp-image-62992" title="jpegmini" src="http://cdn1.1stwebdesigner.com/wp-content/uploads/2012/01/jpegmini.jpg" alt="" width="476" height="391" /></a></p>
<h2>Remove components</h2>
<hr style="margin-left: 20px;" align="left" width="60%" />
<p>We talked about just a few of many jQuery Mobile&#8217;s components. So it&#8217;s more likely you won&#8217;t be using them all.</p>
<p>The good news is that you can easily remove them, by <a href="http://jquerymobile.com/blog/2011/08/03/jquery-mobile-beta-2-released/#features">making your own build</a> :)</p>
<p><a href="http://jquerymobile.com/blog/2011/08/03/jquery-mobile-beta-2-released/#features"><img class="alignnone size-full wp-image-62993" title="widgets" src="http://cdn1.1stwebdesigner.com/wp-content/uploads/2012/01/widgets.jpg" alt="" width="476" height="391" /></a></p>
<h2>Now it&#8217;s your turn?</h2>
<hr style="margin-left: 20px;" align="left" width="60%" />
<p>So, how are you planning to use jQuery Mobile? Have another cool tip to share? Don&#8217;t be shy and comment!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.1stwebdesigner.com/css/jquery-mobile-need-to-know/feed/</wfw:commentRss>
		<slash:comments>14</slash:comments>
		</item>
		<item>
		<title>Mouthwatering Collection Of jQuery Plugins And CSS3 Tricks</title>
		<link>http://www.1stwebdesigner.com/css/jquery-plugins-css3-tricks-collection/</link>
		<comments>http://www.1stwebdesigner.com/css/jquery-plugins-css3-tricks-collection/#comments</comments>
		<pubDate>Wed, 30 Nov 2011 21:00:31 +0000</pubDate>
		<dc:creator>Costin Găman</dc:creator>
				<category><![CDATA[Coding]]></category>
		<category><![CDATA[HTML & CSS]]></category>
		<category><![CDATA[JS & AJAX]]></category>
		<category><![CDATA[Plugins]]></category>
		<category><![CDATA[coding]]></category>
		<category><![CDATA[jquery]]></category>
		<category><![CDATA[plugins]]></category>
		<category><![CDATA[showcase]]></category>
		<category><![CDATA[tips]]></category>
		<category><![CDATA[tricks]]></category>

		<guid isPermaLink="false">http://www.1stwebdesigner.com/?p=58825</guid>
		<description><![CDATA[I&#8217;m sure that at one point or another you were designing a website and thought it could use a little something extra. That bit of something that adds extra functionality or enhances what it already has, making it not only easier for the user to receive the information they seek, but also present it in [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m sure that at one point or another you were designing a website and thought it could use a little something extra. That bit of something that adds extra functionality or enhances what it already has, making it not only easier for the user to receive the information they seek, but also present it in a neat package.</p>
<p>In no particular order, I give you a handpicked collection of jQuery plugins and some CSS3 tricks to top it off. Surely, with these in your designer arsenal, your creations will stand out more than ever before.</p>
<p><span id="more-58825"></span></p>
<h2>jQuery</h2>
<h3>1. <a title="Fly-out menu" href="http://tympanus.net/codrops/2010/06/28/awesome-cufonized-fly-out-menu/" target="_blank">Fly-out menu</a></h3>
<p>Excellent when using enlarged text for emphasis along with visual content.<br />
<a title="Fly-out menu" href="http://tympanus.net/codrops/2010/06/28/awesome-cufonized-fly-out-menu/" target="_blank"><img class="aligncenter size-full wp-image-58832" title="01-fly-out-menu" src="http://cdn1.1stwebdesigner.com/wp-content/uploads/2011/11/01-fly-out-menu.jpg" alt="01-fly-out-menu" width="570" height="285" /></a></p>
<h3>2. <a title="Grid portfolio" href="http://tympanus.net/codrops/2011/08/04/fullscreen-grid-portfolio/" target="_blank">Grid portfolio</a></h3>
<p>A very elegant way of displaying items with the possibility of quickly previewing the content.<br />
<em>Suggestion: use with other resizing elements so that the user can see them rearrange.</em><br />
<a title="Grid portfolio" href="http://tympanus.net/codrops/2011/08/04/fullscreen-grid-portfolio/" target="_blank"><img class="aligncenter size-full wp-image-58837" title="02-grid-portfolio" src="http://cdn1.1stwebdesigner.com/wp-content/uploads/2011/11/02-grid-portfolio.jpg" alt="02-grid-portfolio" width="570" height="293" /></a></p>
<h3>3. <a title="Slide out contextual tips" href="http://tutorialzine.com/2010/04/slideout-context-tips-jquery-css3/" target="_blank">Slide out contextual tips</a></h3>
<p>Expanding tool tips with a smooth animation, revealing extra content only when the user wants it.<br />
<em>Suggestion: use with images that display several products (e.g. furniture) or when explaining the highlights of a design in your portfolio.</em><br />
<a title="Slide out contextual tips" href="http://tutorialzine.com/2010/04/slideout-context-tips-jquery-css3/" target="_blank"><img class="aligncenter size-full wp-image-58839" title="03-slide-out-contextual-tips" src="http://cdn1.1stwebdesigner.com/wp-content/uploads/2011/11/03-slide-out-contextual-tips.jpg" alt="03-slide-out-contextual-tips" width="570" height="389" /></a></p>
<h3>4. <a title="Quicksand - reorder and filter" href="http://razorjack.net/quicksand/" target="_blank">Quicksand &#8211; reorder and filter</a></h3>
<p>Organise and reorder items to make it easier to find exactly what you need. Click once and just watch everything slide into place.<br />
<a title="Quicksand - reorder and filter" href="http://razorjack.net/quicksand/" target="_blank"><img class="aligncenter size-full wp-image-58841" title="04-quicksand-reorder-and-filter" src="http://cdn1.1stwebdesigner.com/wp-content/uploads/2011/11/04-quicksand-reorder-and-filter.jpg" alt="04-quicksand-reorder-and-filter" width="570" height="360" /></a></p>
<h3>5. <a title="Sunday morning" href="http://sundaymorning.jaysalvat.com/" target="_blank">Sunday morning &#8211; translation plugin</a></h3>
<p>A little old, but still awesome. It adds a simple and appealing way of translating a website or just parts of it.<br />
<a title="Sunday morning" href="http://sundaymorning.jaysalvat.com/" target="_blank"><img class="aligncenter size-full wp-image-58842" title="05-sunday-morning-translation" src="http://cdn1.1stwebdesigner.com/wp-content/uploads/2011/11/05-sunday-morning-translation.jpg" alt="05-sunday-morning-translation" width="570" height="377" /></a></p>
<h3>6. <a title="Jvectormap" href="http://jvectormap.owl-hollow.net/" target="_blank">jVectorMap</a></h3>
<p>Interactive map with the possibility of expanding for other uses. Includes the world map, US, Europe and Germany.<br />
<a title="Jvectormap" href="http://jvectormap.owl-hollow.net/" target="_blank"><img class="aligncenter size-full wp-image-58845" title="06-jvectormap-interactive-map" src="http://cdn1.1stwebdesigner.com/wp-content/uploads/2011/11/06-jvectormap-interactive-map.jpg" alt="06-jvectormap-interactive-map" width="570" height="375" /></a></p>
<h3>7. <a title="Shuffle letters effect" href="http://tutorialzine.com/2011/09/shuffle-letters-effect-jquery/" target="_blank">Shuffle letters effect</a></h3>
<p>An interesting effect that can be added to make text elements more eye-catching. Basically, it shows random characters as it reveals the actual text.<br />
<em>Suggestion: use sparingly so as not to make everything confusing.</em><br />
<a title="Shuffle letters effect" href="http://tutorialzine.com/2011/09/shuffle-letters-effect-jquery/" target="_blank"><img class="aligncenter size-full wp-image-58847" title="07-shuffle-letters-effect" src="http://cdn1.1stwebdesigner.com/wp-content/uploads/2011/11/07-shuffle-letters-effect.jpg" alt="07-shuffle-letters-effect" width="570" height="339" /></a></p>
<h3>8. <a title="Mosaiqy" href="http://www.fabriziocalderan.it/mosaiqy/" target="_blank">Mosaiqy &#8211; picture shuffle</a></h3>
<p>Display pictures in a simple grid that shuffles the elements in a Rubik&#8217;s cube fashion.<br />
<a title="Mosaiqy" href="http://www.fabriziocalderan.it/mosaiqy/" target="_blank"><img class="aligncenter size-full wp-image-58849" title="08-mosaiqy-picture-shuffle" src="http://cdn1.1stwebdesigner.com/wp-content/uploads/2011/11/08-mosaiqy-picture-shuffle.jpg" alt="08-mosaiqy-picture-shuffle" width="570" height="264" /></a></p>
<h3>9. <a title="Sponsor wall flip" href="http://tutorialzine.com/2010/03/sponsor-wall-flip-jquery-css/" target="_blank">Sponsor wall flip</a></h3>
<p>Although the title says &#8220;sponsor wall flip&#8221;, that&#8217;s just one of the many uses for this plugin. Show visual elements and put bite-sized information on the back.<br />
<em>Note: contains a little PHP.</em><br />
<a title="Sponsor wall flip" href="http://tutorialzine.com/2010/03/sponsor-wall-flip-jquery-css/" target="_blank"><img class="aligncenter size-full wp-image-58850" title="09-sponsor-wall-flip" src="http://cdn1.1stwebdesigner.com/wp-content/uploads/2011/11/09-sponsor-wall-flip.jpg" alt="09-sponsor-wall-flip" width="570" height="340" /></a></p>
<h3>10. <a title="Colourful jQuery clock" href="http://tutorialzine.com/2009/12/colorful-clock-jquery-css/" target="_blank">Colourful jQuery clock</a></h3>
<p>Add a colourful and modern clock to your design or perhaps even adapt it into a countdown for when launching a new website!<br />
<a title="Colourful jQuery clock" href="http://tutorialzine.com/2009/12/colorful-clock-jquery-css/" target="_blank"><img class="aligncenter size-full wp-image-58852" title="10-colorful-jquery-clock" src="http://cdn1.1stwebdesigner.com/wp-content/uploads/2011/11/10-colorful-jquery-clock.jpg" alt="10-colorful-jquery-clock" width="570" height="198" /></a></p>
<h3>11. <a title="MopTip2" href="http://www.mopstudio.jp/mopTip2descrip.html" target="_blank">MopTip2</a></h3>
<p>MopTip2 is a plugin that lets you add customizable tooltips to various elements. The tooltips can close automatically or be manually closed and they may also display images.<br />
<a title="MopTip2" href="http://www.mopstudio.jp/mopTip2descrip.html" target="_blank"><img class="aligncenter size-full wp-image-58853" title="11-mop-tip-2" src="http://cdn1.1stwebdesigner.com/wp-content/uploads/2011/11/11-mop-tip-2.jpg" alt="11-mop-tip-2" width="570" height="360" /></a></p>
<h3>12. <a title="Grumble" href="http://jamescryer.github.com/grumble.js/" target="_blank">Grumble</a></h3>
<p>Another tooltip plugin with the added bonus of being able to use virtually any CSS styles and transform them into whatever you may want.<br />
<a title="Grumble" href="http://jamescryer.github.com/grumble.js/" target="_blank"><img class="aligncenter size-full wp-image-58855" title="12-grumble-tooltip" src="http://cdn1.1stwebdesigner.com/wp-content/uploads/2011/11/12-grumble-tooltip.jpg" alt="12-grumble-tooltip" width="570" height="187" /></a></p>
<h3>13. <a title="jQuery Timelnr" href="http://www.csslab.cl/2011/08/18/jquery-timelinr/" target="_blank">jQuery Timelnr</a></h3>
<p>Timelnr is a stylish timeline gallery with the option of placing it horizontally or vertically, and having it play automatically.<br />
<a title="jQuery Timelnr" href="http://www.csslab.cl/2011/08/18/jquery-timelinr/" target="_blank"><img class="aligncenter size-full wp-image-58856" title="13-jquery-timelnr" src="http://cdn1.1stwebdesigner.com/wp-content/uploads/2011/11/13-jquery-timelnr.jpg" alt="13-jquery-timelnr" width="570" height="283" /></a></p>
<h3>14. <a title="Flexible nav" href="http://demo.greweb.fr/flexible-nav/" target="_blank">Flexible nav</a></h3>
<p>By just marking certain elements in the HTML, this plugin will automatically create a navigation menu for you, acting like small bookmarks placed neatly on the side of the window.<br />
<a title="Flexible nav" href="http://demo.greweb.fr/flexible-nav/" target="_blank"><img class="aligncenter size-full wp-image-58857" title="14-flexible-nav" src="http://cdn1.1stwebdesigner.com/wp-content/uploads/2011/11/14-flexible-nav.jpg" alt="14-flexible-nav" width="570" height="223" /></a></p>
<h3>15. <a title="Deck - HTML presentations" href="http://imakewebthings.github.com/deck.js/" target="_blank">Deck &#8211; HTML presentations</a></h3>
<p>Ever thought PowerPoint or Keynote presentations were cumbersome? Then look no further! With Deck you can create online HTML presentations with a multitude of uses, perhaps enhancing an e-learning product.<br />
<a title="Deck - HTML presentations" href="http://imakewebthings.github.com/deck.js/" target="_blank"><img class="aligncenter size-full wp-image-58858" title="15-deck-presentations" src="http://cdn1.1stwebdesigner.com/wp-content/uploads/2011/11/15-deck-presentations.jpg" alt="15-deck-presentations" width="570" height="343" /></a></p>
<h3>16. <a title="Apple-like Retina effect" href="http://tutorialzine.com/2010/06/apple-like-retina-effect-jquery-css/" target="_blank">Apple-like Retina effect</a></h3>
<p>Enhance your content by letting users see the finer details with this Retina-like plugin.<br />
<a title="Apple-like Retina effect" href="http://tutorialzine.com/2010/06/apple-like-retina-effect-jquery-css/" target="_blank"><img class="aligncenter size-full wp-image-58859" title="16-retina-effect" src="http://cdn1.1stwebdesigner.com/wp-content/uploads/2011/11/16-retina-effect.jpg" alt="16-retina-effect" width="570" height="314" /></a></p>
<h3>17. <a title="jQuery pageSlide" href="http://srobbin.com/blog/jquery-pageslide/" target="_blank">jQuery pageSlide</a></h3>
<p>Simple and effective, pageSlide reveals information by pushing the entire page to the side, thus not disrupting the positions of other elements.<br />
<em>Suggestion: it could be used to hide a vertical navigation, leaving room for full-page content.</em><br />
<a title="jQuery pageSlide" href="http://srobbin.com/blog/jquery-pageslide/" target="_blank"><img class="aligncenter size-full wp-image-58860" title="17-jquery-page-slide" src="http://cdn1.1stwebdesigner.com/wp-content/uploads/2011/11/17-jquery-page-slide.jpg" alt="17-jquery-page-slide" width="570" height="301" /></a></p>
<h3>18. <a title="jqFancyTransitions" href="http://workshop.rs/projects/jqfancytransitions/" target="_blank">jqFancyTransitions</a></h3>
<p>A simple and sleek gallery with strip transitions and several formats.<br />
<a title="jqFancyTransitions" href="http://workshop.rs/projects/jqfancytransitions/" target="_blank"><img class="aligncenter size-full wp-image-58861" title="18-jquery-fancy-transitions" src="http://cdn1.1stwebdesigner.com/wp-content/uploads/2011/11/18-jquery-fancy-transitions.jpg" alt="18-jquery-fancy-transitions" width="570" height="420" /></a></p>
<h3>19. <a title="Panning slideshow" href="http://s3.amazonaws.com/buildinternet/live-tutorials/panning-slideshow/panning-slideshow.htm" target="_blank">Panning slideshow</a></h3>
<p>A more interesting slideshow which pieces together the slides and pans through them with a slightly elastic effect.<br />
<em>Suggestion: given the effect, the slides could actually be parts of one big image for something more special.</em><br />
<a title="Panning slideshow" href="http://s3.amazonaws.com/buildinternet/live-tutorials/panning-slideshow/panning-slideshow.htm" target="_blank"><img class="aligncenter size-full wp-image-58862" title="19-panning-slideshow" src="http://cdn1.1stwebdesigner.com/wp-content/uploads/2011/11/19-panning-slideshow.jpg" alt="19-panning-slideshow" width="570" height="305" /></a></p>
<h3>20. <a title="jqZoom" href="http://www.mind-projects.it/projects/jqzoom/" target="_blank">jqZoom</a></h3>
<p>Similar to the Retina plugin, jqZoom can be customized in more ways and has more zooming options, such as drag-zoom or through simple mouse-over.<br />
<a title="jqZoom" href="http://www.mind-projects.it/projects/jqzoom/" target="_blank"><img class="aligncenter size-full wp-image-58863" title="20-jquery-jqzoom" src="http://cdn1.1stwebdesigner.com/wp-content/uploads/2011/11/20-jquery-jqzoom.jpg" alt="20-jquery-jqzoom" width="570" height="319" /></a></p>
<h3>21. <a title="3D tag cloud" href="http://www.iangeorge.net/snippets/tags/" target="_blank">3D tag cloud</a></h3>
<p>Add a little creativity to your tag cloud by turning it into a tag sphere! Just click and drag to rotate it and use the mouse wheel to zoom in and out. The plugin simply transforms all divs that have the class &#8220;tags&#8221; and contain an unordered list with links inside.<br />
<em>Suggestion: since all it needs is a div, why not be creative and apply it to a navigation?</em><br />
<a title="3D tag cloud" href="http://www.iangeorge.net/snippets/tags/" target="_blank"><img class="aligncenter size-full wp-image-59130" title="21-jquery-3D-tag-cloud" src="http://cdn1.1stwebdesigner.com/wp-content/uploads/2011/11/21-jquery-3D-tag-cloud.jpg" alt="21-jquery-3D-tag-cloud" width="570" height="265" /></a></p>
<h3>22. <a title="JEffects" href="http://rezoner.net/labs/jeffects/index.html" target="_blank">JEffects</a></h3>
<p>JEffects is a plugin containing more effects that can be applied to various elements within your website. For instance, it can be applied to input fields to create a very pleasant effect.<br />
<em>Note: not free.</em><br />
<a title="JEffects" href="http://rezoner.net/labs/jeffects/index.html" target="_blank"><img class="aligncenter size-full wp-image-59134" title="22-jquery-jeffects" src="http://cdn1.1stwebdesigner.com/wp-content/uploads/2011/11/22-jquery-jeffects.jpg" alt="22-jquery-jeffects" width="566" height="252" /></a></p>
<h3>23. <a title="PhotoShelf" href="http://rezoner.net/labs/photoshelf/" target="_blank">PhotoShelf</a></h3>
<p>PhotoShelf is an elegant gallery that allows you to scroll through a collection of images and zoom in on portions of the selected image. It can also add separators in the stack to organise your items.<br />
<em>Note: not free.</em><br />
<a title="PhotoShelf" href="http://rezoner.net/labs/photoshelf/" target="_blank"><img class="aligncenter size-full wp-image-59135" title="23-jquery-photo-shelf" src="http://cdn1.1stwebdesigner.com/wp-content/uploads/2011/11/23-jquery-photo-shelf.jpg" alt="23-jquery-photo-shelf" width="570" height="296" /></a></p>
<h3>24. <a title="Grid accordion with jQuery" href="http://css-tricks.com/5994-grid-accordion-with-jquery/" target="_blank">Grid accordion</a></h3>
<p>A double accordion, if you will. It smoothly expands to an easier to read width and makes room for subcategories, also displayed inside an accordion.<br />
<a title="Grid accordion with jQuery" href="http://css-tricks.com/5994-grid-accordion-with-jquery/" target="_blank"><img class="aligncenter size-full wp-image-59138" title="24-jquery-info-grid" src="http://cdn1.1stwebdesigner.com/wp-content/uploads/2011/11/24-jquery-info-grid.jpg" alt="24-jquery-info-grid" width="570" height="283" /></a></p>
<h3>25. <a title="Latest tweets tooltip" href="http://tympanus.net/codrops/2010/07/20/latest-tweets-tooltip/" target="_blank">Latest tweets tooltip</a></h3>
<p>A very interesting plugin that lets you display the latest tweets about a certain topic inside a resizeable tooltip.<br />
<a title="Latest tweets tooltip" href="http://tympanus.net/codrops/2010/07/20/latest-tweets-tooltip/" target="_blank"><img class="aligncenter size-full wp-image-59148" title="25-jquery-tweet-feed" src="http://cdn1.1stwebdesigner.com/wp-content/uploads/2011/11/25-jquery-tweet-feed.jpg" alt="25-jquery-tweet-feed" width="570" height="390" /></a></p>
<h2>Bonus: a few CSS tricks</h2>
<h3>1. <a title="CSS3 Transitions, Transforms and Animations" href="http://css3.bradshawenterprises.com/" target="_blank">CSS3 Transitions, Transforms and Animations</a></h3>
<p>Everything you wanted to know about CSS3, plus some tutorials on how to create some nifty enhancements.<br />
<em>Note: some tutorials contain some JavaScript.</em><br />
<a title="CSS3 Transitions, Transforms and Animations" href="http://css3.bradshawenterprises.com/" target="_blank"><img class="aligncenter size-full wp-image-58941" title="CSS-01-transitions-transforms-animations" src="http://cdn1.1stwebdesigner.com/wp-content/uploads/2011/11/CSS-01-transitions-transforms-animations.jpg" alt="CSS-01-transitions-transforms-animations" width="570" height="345" /></a></p>
<h3>2. <a title="Pure CSS Accordion" href="http://www.paulrhayes.com/2009-06/accordion-using-only-css/" target="_blank">Pure CSS Accordion</a></h3>
<p>As the title implies, this simple but versatile effect is made with pure CSS transitions, taking advantage of anchors.<br />
<a title="Pure CSS Accordion" href="http://www.paulrhayes.com/2009-06/accordion-using-only-css/" target="_blank"><img class="aligncenter size-full wp-image-58944" title="CSS-02-accordion" src="http://cdn1.1stwebdesigner.com/wp-content/uploads/2011/11/CSS-02-accordion.jpg" alt="CSS-02-accordion" width="570" height="365" /></a></p>
<h3>3. <a title="OS X dock" href="http://www.zurb.com/playground/osx-dock" target="_blank">OS X dock</a></h3>
<p>Create an OS X dock with CSS3 properties, including reflections to make your design stand out.<br />
<a title="OS X dock" href="http://www.zurb.com/playground/osx-dock" target="_blank"><img class="aligncenter size-full wp-image-58945" title="CSS-03-mac-dock" src="http://cdn1.1stwebdesigner.com/wp-content/uploads/2011/11/CSS-03-mac-dock.jpg" alt="CSS-03-mac-dock" width="570" height="240" /></a></p>
<h3>4. <a title="CSS media query" href="http://css-tricks.com/6731-css-media-queries/" target="_blank">CSS media query</a></h3>
<p>Learn how to hide and display elements according to the size of the screen. A step towards responsive web design.</p>
<h3>5. <a title="CSS3 Multi column" href="http://net.tutsplus.com/tutorials/html-css-techniques/quick-tip-the-multi-column-css3-module/" target="_blank">CSS3 multi column</a></h3>
<p>With just one line of code you can split a text container into columns, lending itself nicely to dynamic content.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.1stwebdesigner.com/css/jquery-plugins-css3-tricks-collection/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Simon&#8217;s Google Doodle &#8211; HTML5 + JS jQuery Game</title>
		<link>http://www.1stwebdesigner.com/css/simons-google-doodle-html-js-jquery-game/</link>
		<comments>http://www.1stwebdesigner.com/css/simons-google-doodle-html-js-jquery-game/#comments</comments>
		<pubDate>Wed, 24 Aug 2011 10:00:05 +0000</pubDate>
		<dc:creator>Rochester Oliveira</dc:creator>
				<category><![CDATA[Coding]]></category>
		<category><![CDATA[HTML & CSS]]></category>
		<category><![CDATA[JS & AJAX]]></category>
		<category><![CDATA[coding]]></category>
		<category><![CDATA[google doodle]]></category>
		<category><![CDATA[html]]></category>
		<category><![CDATA[jquery]]></category>
		<category><![CDATA[js game]]></category>
		<category><![CDATA[tutorial]]></category>

		<guid isPermaLink="false">http://www.1stwebdesigner.com/?p=49432</guid>
		<description><![CDATA[Dude, you&#8217;ve heard a lot about Google doodles haven&#8217;t you? What about that Pacman one? It is just addictive. Company owners know how a funny game and unlimited search powers could be dangerous for productivity. And how it can be a marketing boost. The most amazing thing is that we can create our own addictive [...]]]></description>
			<content:encoded><![CDATA[<p>Dude, you&#8217;ve heard a lot about Google doodles haven&#8217;t you? What about that Pacman one? It is just addictive. Company owners know how a funny game and unlimited search powers could be dangerous for productivity. And how it can be a marketing boost. The most amazing thing is that we can create our own addictive HTML game. Actually, this is why we are here today. With this tutorial you&#8217;ll see how to use some of JavaScript and HTML capabilities to build simple yet funny games.</p>
<p>So, let&#8217;s rock!</p>
<p><span id="more-49432"></span></p>
<h2>Demo first, please</h2>
<p>You can <a href="http://dl.dropbox.com/u/35995890/doodle/doodle.zip" target="_blank">download</a> or try our <a href="http://dl.dropbox.com/u/35995890/doodle/index.html" target="_blank">online demo</a>. Please, don&#8217;t forget to come back here if you want to just go playing first :)</p>
<p><img class="alignnone size-full wp-image-52224" title="demo" src="http://cdn1.1stwebdesigner.com/wp-content/uploads/2011/07/demo1.jpg" alt="" width="600" height="352" /></p>
<h2>“Well, actually I don&#8217;t know what a Doodle is..”</h2>
<p>Google Doodles started when Larry and Sergey played with the corporate logo to indicate their attendance at the Burning Man festival in the Nevada desert. Since that day we&#8217;ve seen a lot of funny Doodles, and Google&#8217;s homepage is used to remind us of all kind of important facts.</p>
<p>But they are more than just paintings, games or experiments. They are  made with the best current practices (some of them, created specifically for a Doodle). And Google being as supportive as they are of open source technology, usually release the commented source code, so you can just  take a look and try to understand what those amazing guys are doing.</p>
<p>Oh, and I don&#8217;t know if you knew about it, but today is Simon&#8217;s day according to 1stWebdesigner&#8217;s official fake holiday calendar. Seems important, right? This is why we&#8217;ll build a game for it.</p>
<h2>So, what will we be doing?</h2>
<p>Simon is one of my favorite games (just after Sudoku and Gammon). Can you think of an easier game to code? You know, four buttons, easy actions. I just can&#8217;t think of a better starting point to learn HTML5 gaming.</p>
<p>Well, first of all you need to know what this Simon thing looks like. I just found a picture of it at <a rel="nofollow" href="http://produto.mercadolivre.com.br/MLB-189683151-genius-da-estrela-icone-dos-anos-80-_JM">Mercado Livre</a> (kind of a Brazilian e-bay) and made my own version in Photoshop.</p>
<p>Since we are doing it via HTML5, the colors shouldn&#8217;t be directly on image (otherwise you won&#8217;t be able to change colors, make your own console&#8230;). So I&#8217;ve used <a href="http://css-tricks.com/9561-color-animate-any-shape-2/" target="_blank">Chris Coyier</a>&#8216;s technique for color animation. Basically we make our non-colored elements, and leave everything else transparent. Then our HTML5 will take care of the color itself (via CSS, background-color). Our final game background will be something like this:</p>
<p><img class="alignnone size-full wp-image-52226" style="border: 1px solid #f0f0f0;" title="bg" src="http://cdn1.1stwebdesigner.com/wp-content/uploads/2011/07/bg.jpg" alt="" width="300" height="300" /></p>
<p>Ok, then. Let&#8217;s start the fun part.</p>
<h2>Basic HTML + CSS</h2>
<p>Since our target isn&#8217;t basic HTML itself, I just grab a copy of <a href="http://html5boilerplate.com/">HTML5 Boilerplate</a> with a few edits to make it cleaner:</p>
<pre class="brush: php; title: ; notranslate">
&lt;!DOCTYPE html&gt;
&lt;html lang=&quot;en&quot;&gt;
&lt;head&gt;
  &lt;meta charset=&quot;utf-8&quot;&gt;

  &lt;title&gt;Google.com - Simon's day  (1stWebDesigner.com game :D)&lt;/title&gt;

  &lt;link rel=&quot;stylesheet&quot; href=&quot;css/style.css?v=2&quot;&gt;
  &lt;script src=&quot;js/libs/modernizr-1.7.min.js&quot;&gt;&lt;/script&gt;
&lt;/head&gt;
&lt;body&gt;
  &lt;div id=&quot;container&quot;&gt;
    &lt;div id=&quot;main&quot;&gt;
	&lt;!-- Game controls and deisgn --&gt;
    &lt;/div&gt;
	&lt;form id=&quot;search&quot; action=&quot;#&quot; method=&quot;get&quot;&gt;
		&lt;input type=&quot;text&quot; name=&quot;query&quot; id=&quot;query&quot; /&gt;
		&lt;input type=&quot;submit&quot; value=&quot;search&quot; id=&quot;submit&quot; /&gt;
	&lt;/form&gt;
	&lt;div id=&quot;options&quot;&gt;
		&lt;!-- game options --&gt;
	&lt;/div&gt;
  &lt;/div&gt;

  &lt;script src=&quot;//ajax.googleapis.com/ajax/libs/jquery/1.5.1/jquery.js&quot;&gt;&lt;/script&gt;
  &lt;script src=&quot;js/script.js&quot;&gt;&lt;/script&gt;
&lt;/body&gt;
&lt;/html&gt;
</pre>
<p>Now we need our gaming HTML stuff. As we&#8217;ve done it ready for different colors we will need to have two layers:</p>
<ul>
<li>Background color- sets the color and will be animated when you activate a button</li>
<li>Link &#8211; activates all actions for each colored button.</li>
<li>Alerts &#8211; since they are part of the game itself, we&#8217;ll put them with all other game controls (level up, new game, game over)</li>
</ul>
<p>Our HTML for this part will be something like this:</p>
<pre class="brush: php; title: ; notranslate">
	&lt;div id=&quot;main&quot;&gt;
	&lt;!-- lights --&gt;
		&lt;div id=&quot;box-0&quot; class=&quot;box&quot;&gt;&amp;nbsp;&lt;/div&gt;
		&lt;div id=&quot;box-1&quot; class=&quot;box&quot;&gt;&amp;nbsp;&lt;/div&gt;
		&lt;div id=&quot;box-2&quot; class=&quot;box&quot;&gt;&amp;nbsp;&lt;/div&gt;
		&lt;div id=&quot;box-3&quot; class=&quot;box&quot;&gt;&amp;nbsp;&lt;/div&gt;
	&lt;!-- buttons --&gt;
		&lt;a href=&quot;#&quot; class=&quot;box btnTL&quot; id=&quot;box-click-0&quot;&gt;&amp;nbsp;&lt;/a&gt;
		&lt;a href=&quot;#&quot; class=&quot;box btnTR&quot; id=&quot;box-click-1&quot;&gt;&amp;nbsp;&lt;/a&gt;
		&lt;a href=&quot;#&quot; class=&quot;box btnBL&quot; id=&quot;box-click-2&quot;&gt;&amp;nbsp;&lt;/a&gt;
		&lt;a href=&quot;#&quot; class=&quot;box btnBR&quot; id=&quot;box-click-3&quot;&gt;&amp;nbsp;&lt;/a&gt;
	&lt;!-- alerts --&gt;
		&lt;div id=&quot;letsRock&quot; class=&quot;alert&quot;&gt;
			&lt;p&gt;Ready? let's rock!&lt;/p&gt;
		&lt;/div&gt;
		&lt;div id=&quot;ohYes&quot; class=&quot;alert&quot;&gt;
			&lt;p&gt;Oh Yeah!&lt;/p&gt;
		&lt;/div&gt;
		&lt;div id=&quot;ohNoes&quot; class=&quot;alert&quot;&gt;
			&lt;p&gt;Oh Noes... Almost there! &lt;/p&gt;
		&lt;/div&gt;
	&lt;/div&gt;
</pre>
<p>As you can see, the four &#8220;div.box&#8221; elements are the background color for each button (red, blue, green, red).</p>
<p>So when someone clicks #box-click-0 it will &#8220;activate&#8221; the button #box-0. We have a lot of id&#8217;s because they result in better JS performance.</p>
<p>Our CSS for that will be:</p>
<pre class="brush: php; title: ; notranslate">
#main {
	position: relative;
	left: 155px;
	width: 200px;
	height: 200px;
}
	.box {
		display: block;
		float: left;
		width: 100px;
		height: 100px;
	}
	a.box {
		position: absolute;
		text-decoration: none;
		background-image: url(&quot;../img/bg_game.png&quot;);
		background-repeat: no-repeat;
	}
	a.box:focus {
		outline: none;
	}
	.btnTL { background-position: top left; }
	.btnTR { background-position: top right; }
	.btnBL { background-position: bottom left; }
	.btnBR { background-position: bottom right; }
		 .btnTL, .btnTR {
			top: 0;
		 }
		 .btnBL, .btnBR {
			bottom: 0;
		 }
		 .btnTL, .btnBL {
			left: 0;
		 }
		 .btnTR, .btnBR {
			right: 0;
		 }
	#box-0 {
		background: #c00000;
	}
	#box-1 {
		background: #1506a3;
	}
	#box-2 {
		background: #046606;
	}
	#box-3 {
		background: #ea8f0c;
	}
</pre>
<p>Here is our effect: all our links have the console background, bg_game.png (positioned according to what it should be, of course). Since they are on top of divs, what we will see is the bg_game.png AND the element&#8217;s color ( #c00000, #1506a3&#8230;).</p>
<p>Ok, we won&#8217;t be long on this. Maybe this is enough topic for a single article :)</p>
<h2>Search form</h2>
<p>Have you noticed the recent (ok, maybe not that recent) Google&#8217;s switch to real time results? That&#8217;s pretty cool, yeah, I know. But it makes a little bit harder to link directly to a search results page.</p>
<p>Since our demo has a search form and we want to make it work, let&#8217;s put a little JS magic on it:</p>
<pre class="brush: php; title: ; notranslate">
	&lt;form id=&quot;search&quot; action=&quot;#&quot; method=&quot;get&quot;&gt;
		&lt;input type=&quot;text&quot; name=&quot;query&quot; id=&quot;query&quot; /&gt;
		&lt;input type=&quot;submit&quot; value=&quot;search&quot; id=&quot;submit&quot; /&gt;
	&lt;/form&gt;
</pre>
<p>Javascript:</p>
<pre class="brush: php; title: ; notranslate">
$(function(){
	$(&quot;#search&quot;).submit( function(event) { event.preventDefault(); googleRedirect(); } );
});
function googleRedirect() {
	var query = $(&quot;#query&quot;).attr('value');
	var url = &quot;http://www.google.com/#q=&quot; + query + &quot;&amp;fp=1&quot;;
	window.location = url;
}
</pre>
<p>This way it will work ;)</p>
<h2>Cookies? No, no, local storage instead!</h2>
<p>Well, Cookies are great for some things, but this time they aren&#8217;t the very best option. Here we will make use of Local Storage. This is basically the same idea as Cookies, it allows you to store data related to your site, the difference is that it&#8217;s faster and very useful in some situations.</p>
<p>As its name suggest it is local, so it won&#8217;t be sent to the server (you save a few kbytes and processing). Cookies are limited to 4kB and 20 Cookies per domain. With local storage you can record up to 5MB of user data.</p>
<p>The only downside is that it works only on real browsers and IE8+. So, forget about IE7 this time (maybe later with some jQuery data fallback).</p>
<p>Another huge advantage is that it is surprisingly easy to set / remove;</p>
<pre class="brush: php; title: ; notranslate">
localStorage[&quot;level&quot;] = 15; // create it with 15 as value
var level = localStorage[&quot;level&quot;];  //now var level is 15
localStorage.removeItem( &quot;level&quot; ); //remove it!
</pre>
<p>So, this is why we will use it this time.</p>
<h2>A few options</h2>
<p>Then we need to have a way to start the game, see which level we&#8217;re playing, these sort of trivial things. For this, we&#8217;ll just put a simple HTML box with Google&#8217;s logo:</p>
<pre class="brush: php; title: ; notranslate">
&lt;div id=&quot;options&quot;&gt;
	&lt;ul&gt;
		&lt;li&gt;Level: &lt;span id=&quot;levelCount&quot;&gt;1&lt;/span&gt;&lt;/li&gt;
		&lt;li&gt;&lt;a href=&quot;#&quot; onclick=&quot;newGame()&quot; &gt;New Game&lt;/a&gt;&lt;/li&gt;
		&lt;li&gt;High Score: &lt;span id=&quot;hs&quot;&gt;1&lt;/span&gt;&lt;/li&gt;
		&lt;li&gt;&lt;a href=&quot;http://www.1stwebdesigner.com&quot; target=&quot;_blank&quot; &gt;Credits&lt;/a&gt;&lt;/li&gt;
	&lt;/ul&gt;
&lt;/div&gt;
</pre>
<p>Well, what is important here is that our counters have id&#8217;s wrapping them, so we can easily change their text.</p>
<h2>Let the game begin</h2>
<h3>Random sequence</h3>
<p>The very first thing to do when you start this game should be to generate a random sequence. Because this sequence will be the &#8220;right path&#8221; to be followed by players. We could generate it on-the-fly as our gamer reaches new levels, but it will be easier to do this way.</p>
<p>So we will create a simple function that just generate a random sequence with 50 digits (levels) and only with numbers from 0 to 3 (our colors!):</p>
<pre class="brush: php; title: ; notranslate">
function randomSequence() {
	var chars = &quot;0123&quot;; // four colors!
	var string_length = 50; //pretty hard, isn't it?
	var sequence = &quot;&quot;;
	for (var i=0; i &lt; string_length; i++) { //we'll have from sequence[0] to sequence[49]
		var rnum = Math.floor(Math.random() * chars.length);
		sequence += chars.substring(rnum,rnum+1);
	}
	return sequence;
}
</pre>
<h3>Binding clicks and hovers</h3>
<p>Now we need to prepare our all a.box elements to recognize clicks and to animate properly our div.box when you hover any of them.</p>
<p>This time we will need jQuery .hover() and .click() functions:</p>
<pre class="brush: php; title: ; notranslate">
$(function(){
//caching our elements for better performance
box0 = $(&quot;#box-0&quot;);
box1 = $(&quot;#box-1&quot;);
box2 = $(&quot;#box-2&quot;);
box3 = $(&quot;#box-3&quot;);
clickbox0 = $(&quot;#box-click-0&quot;);
clickbox1 = $(&quot;#box-click-1&quot;);
clickbox2 = $(&quot;#box-click-2&quot;);
clickbox3 = $(&quot;#box-click-3&quot;);
clickbox0.click(
	function(event){
		event.preventDefault();
		clicked(0);
	}
);
clickbox1.click(
	function(event){
		event.preventDefault();
		clicked(1);
	}
);
clickbox2.click(
	function(event){
		event.preventDefault();
		clicked(2);
	}
);
clickbox3.click(
	function(event){
		event.preventDefault();
		clicked(3);
	}
);
var minHover = 0.7;
var maxHover = 1;
var timeHover = 500;
clickbox0.hover(
	function(){
		box0.stop().animate({opacity: minHover}, timeHover);
	}, function() {
		box0.stop().animate({opacity: maxHover}, timeHover);
	}
);
clickbox1.hover(
	function(){
		box1.stop().animate({opacity: minHover}, timeHover);
	}, function() {
		box1.stop().animate({opacity: maxHover}, timeHover);
	}
);
clickbox2.hover(
	function(){
		box2.stop().animate({opacity: minHover}, timeHover);
	}, function() {
		box2.stop().animate({opacity: maxHover}, timeHover);
	}
);
clickbox3.hover(
	function(){
		box3.stop().animate({opacity: minHover}, timeHover);
	}, function() {
		box3.stop().animate({opacity: maxHover}, timeHover);
	}
);
});
</pre>
<p>It is pretty important caching all our elements, since it improves a lot our performance.</p>
<h3>Magical JS variable variables and easy error detection</h3>
<p>At this point you have coded all the hover and click elements, but when you click them nothing happens, of course. Let&#8217;s fix it:</p>
<pre class="brush: php; title: ; notranslate">
// yeah, someone is playing it!
function clicked( color ) {
	// refresh my memory, how long have you gone so far?
	var level = localStorage[&quot;level&quot;]; // this is our current level
	var clicks = localStorage[&quot;clicks&quot;]; //this is our current item INSIDE one level
	var speed = localStorage[&quot;speed&quot;]; //to make it more fun, when you get right it goes faster
	// blink it!
	window['box' + color].stop().animate({ opacity: 0.3 }, (speed * 0.5) ).animate({ &quot;opacity&quot;: &quot;1&quot; }, (speed * 0.3) ); //variable variables in js via window[varname] :)
	// well, this time you've got it right?
	if ( localStorage[&quot;sequence&quot;][clicks] == color) {
		//oh, yeah!
		localStorage[&quot;clicks&quot;]++;
		//have you finished this level?
		if ( level == clicks) {
			nextLevel();
		}
	} else {
		//oh, noes!
		endGame();
	}
}
</pre>
<p>Every variable in javascript can be accessed via its own name, like box1 OR as an index inside window array, just like window['box1']. With this we can easily select which is the right element to blink (when you click any button, it should blink, right?).</p>
<h3>Ok, you are right! Let&#8217;s go to the next level</h3>
<p>When you get it right, the game should get you to the next level and the events should accelerate a little bit.</p>
<p>Then when you get it right you should also know which is the right sequence at your current level + 1, so let&#8217;s do it:</p>
<pre class="brush: php; title: ; notranslate">
function nextLevel() {
	//Oh, Yes
	showBox(&quot;#ohYes&quot;, 1000);
	// you deserve it, let's move on
	localStorage[&quot;level&quot;]++;
	levelCount.text(localStorage[&quot;level&quot;]);

	localStorage[&quot;clicks&quot;] = 0;
	//let's show you how it'll be
	current = 0; //since it's used just for animation, let's leave it as global var
	if ( localStorage[&quot;speed&quot;] &gt; 300 &amp;&amp; (localStorage[&quot;level&quot;] / 5) == 0 ) { //our maximum speed, and we'll only acelerate it each 5 levels
		localStorage[&quot;speed&quot;] = localStorage[&quot;speed&quot;] * 0.8;
	}
	setTimeout( function() { rightPath(); } , localStorage[&quot;speed&quot;] );
}
</pre>
<p>Function showBox  just shows our div and hides it after one second.</p>
<p>As you can see this piece of code isn&#8217;t complete, we will need the function rightPath() to see what comes next. Let&#8217;s go:</p>
<pre class="brush: php; title: ; notranslate">
function rightPath() {
	if ( current &lt;= localStorage[&quot;level&quot;] ) {
		var sel = localStorage[&quot;sequence&quot;][current];
		window['box' + sel].stop().animate({ &quot;opacity&quot;: &quot;0.5&quot; }, (localStorage[&quot;speed&quot;] * 0.5) ).animate({ &quot;opacity&quot;: &quot;1&quot; }, (localStorage[&quot;speed&quot;] * 0.3) );
		setTimeout(
			function() {
				rightPath();
			},
			(localStorage[&quot;speed&quot;] * (1.5) )
		);
		current++;
	}
	for (var i=0; i &lt;= localStorage[&quot;level&quot;] ; i++) {
		var time = 1000 * (i + 1);
	}
	i = 0;
}
</pre>
<p>This is kind of crazy, isn&#8217;t it? This is a simple recursive function. It will call itself, blink the right button for one position and then go to the next until we reach user&#8217;s current level.</p>
<h3>What if you get it wrong?</h3>
<p>Maybe instead of click the right button you can just click the wrong button. Then we need to punish you and ban you from the entire world wide web. Let&#8217;s see our function for that:</p>
<pre class="brush: php; title: ; notranslate">
function endGame() {
	//let's see if you have a high score, and save it
	if ( localStorage[&quot;hs&quot;] == undefined || localStorage[&quot;level&quot;] &gt; localStorage[&quot;hs&quot;] ) {
		localStorage[&quot;hs&quot;] = localStorage[&quot;level&quot;];
		$(&quot;#hs&quot;).text(localStorage[&quot;hs&quot;]);
	}

	localStorage.removeItem( &quot;level&quot; );
	// Oh, noes!
	showBox(&quot;#ohNoes&quot;, 2000);
}
</pre>
<p>Well, here we just check if you&#8217;ve done something better than this play and then remove your current level so you can restart a new game and try a little harder :)</p>
<p>By the way, did I mention how will you start a game? No? Sorry, my bad.</p>
<h3>Sorry, NOW the game will begin</h3>
<p>What do we have to do in order to start a match is to reset almost anything we have here and then show what is the right path.</p>
<pre class="brush: php; title: ; notranslate">
// just like starting over!
function newGame() {
	current = 0;
	levelCount.text(1);
	//let's call our sequence and memorize it
	localStorage[&quot;sequence&quot;] = randomSequence();
	//wow, we haven't got anything right until now :)
	localStorage[&quot;level&quot;] = 0;
	//clicks binding
	localStorage[&quot;clicks&quot;] = 0;
	//let's make things slow for now
	localStorage[&quot;speed&quot;] = 1500;
	//let's show our welcome warning
	showBox(&quot;#letsRock&quot;, 2000);
	//and let's show the first color
	rightPath();
}
</pre>
<h2>What is your best score?</h2>
<p>Hope you enjoy this quick HTML5 game tutorial and that you find some easter eggs, you know, since it&#8217;s a JS game we can&#8217;t hide a lot of things on it :)</p>
<p>But the most important thing here is: what is your best score?</p>
]]></content:encoded>
			<wfw:commentRss>http://www.1stwebdesigner.com/css/simons-google-doodle-html-js-jquery-game/feed/</wfw:commentRss>
		<slash:comments>28</slash:comments>
		</item>
		<item>
		<title>jQuery Plugin Development: Hover to Reveal Masked Password</title>
		<link>http://www.1stwebdesigner.com/css/jquery-hover-reveal-masked-password/</link>
		<comments>http://www.1stwebdesigner.com/css/jquery-hover-reveal-masked-password/#comments</comments>
		<pubDate>Sun, 24 Jul 2011 10:00:47 +0000</pubDate>
		<dc:creator>Rochester Oliveira</dc:creator>
				<category><![CDATA[Coding]]></category>
		<category><![CDATA[HTML & CSS]]></category>
		<category><![CDATA[JS & AJAX]]></category>
		<category><![CDATA[coding]]></category>
		<category><![CDATA[forms]]></category>
		<category><![CDATA[html]]></category>
		<category><![CDATA[jquery]]></category>
		<category><![CDATA[password mask]]></category>
		<category><![CDATA[usability]]></category>
		<category><![CDATA[web design]]></category>

		<guid isPermaLink="false">http://www.1stwebdesigner.com/?p=50154</guid>
		<description><![CDATA[We talked about how to improve your HTML forms performance a couple of days ago. There we covered a pretty controversial topic &#8220;Don&#8217;t mask your passwords&#8221;, discussing how bad masking your passwords could be for usability. At this moment, we basically have two options: mask password field and don&#8217;t ask for any feedback, or show [...]]]></description>
			<content:encoded><![CDATA[<p>We talked about <a href="http://www.1stwebdesigner.com/design/10-tips-html-forms-performance">how to improve your HTML forms performance</a> a couple of days ago. There we covered a pretty controversial topic &#8220;Don&#8217;t mask your passwords&#8221;, discussing how bad masking your passwords could be for usability.</p>
<p>At this moment, we basically have two options: mask password field and don&#8217;t ask for any feedback, or show password field as text and potentially decrease security.</p>
<p>This is why I think a hover revealing password could be a really good alternative: You can increase your security, and if you are unsure about what you&#8217;ve typed just go and hover over it.</p>
<p>So, what we will be doing today is a jQuery plugin to do that, and additionally, we will have a behavior pretty similar to what many mobiles does, where we can see the last character for a couple of seconds. This is a good chance to learn more about plugins, dynamically generated content, and some good coding practices.</p>
<p>Moreover with this technique we could apply different effects and a lot of variations since all this things are based on non-obtrusive and almost only decorative javascript.</p>
<p>So, let&#8217;s rock!</p>
<p><span id="more-50154"></span></p>
<h2>Demo, download and preview</h2>
<p>Let&#8217;s begin with the best part. You can see our <a href="http://dl.dropbox.com/u/35995890/hovermask/index.html" target="_blank">working demo</a> or <a href="http://dl.dropbox.com/u/35995890/hovermask/jquery.hp.js" target="_blank">download our files and jQuery plugin</a>.</p>
<p><img class="alignnone size-full wp-image-50373" title="demo" src="http://cdn1.1stwebdesigner.com/wp-content/uploads/2011/07/demo.jpg" alt="" width="550" height="300" /></p>
<h2>Usability background</h2>
<p>Before any coding I think it&#8217;s important to know why are we doing all these things. It is all about user experience and to make things the best they can be.</p>
<p>The man who started discussing masked passwords (as far as I know) is Jakob Nielsen, with his extremist opinion expressed in  <a href="http://www.useit.com/alertbox/passwords.html">stop password masking</a> article. But I really think we don&#8217;t need to stick with just two options. I think we can improve all these techniques, like what mobile developers have done, improving user experience by creating a &#8220;new&#8221; way to input password data.</p>
<p>Don&#8217;t get me wrong, sometimes we do need to just keep masking passwords for security reasons. You know, sometimes we are near suspicious people or jealous girlfriends just waiting for a single mistake to steal our password and make big damage to our online life. But sometimes we don&#8217;t. I mean, we don&#8217;t need to let our software ready only for the worst case.</p>
<p>We have to be ready for the worst and the best. From IE6 (argh!) to Chrome 14.0.803.2 beta. From jealous girlfriends to hurried surfers. This is the tricky part, trying to be the best in most cases.</p>
<p>This is why we can&#8217;t just let passwords to be masked by default. We have to give a better option to our loyal users.</p>
<h2>Getting started</h2>
<p>What we will do here is to get a common password field, change it to text and create a mask above it, which is filled as you type. With this you can do anything with the &#8220;mask&#8221; without affecting the input content itself.</p>
<p>Maybe this image will better explain how it works:</p>
<p><img class="alignnone size-full wp-image-50374" title="password-working" src="http://cdn1.1stwebdesigner.com/wp-content/uploads/2011/07/password-working.gif" alt="" width="500" height="400" /></p>
<p>Well, finally, let&#8217;s get started on coding.</p>
<p>We will start with a pretty basic form markup. As you all know it&#8217;s quite simple, so let&#8217;s add two fields, one that should come with a default value and another in blank, for you to play with as you want.</p>
<pre class="brush: php; title: ; notranslate">
&lt;div id=&quot;container&quot;&gt;
	&lt;h1&gt;Sign Up!&lt;/h1&gt;
	&lt;form action=&quot;#&quot; method=&quot;get&quot;&gt;
		&lt;label&gt;
			&lt;span class=&quot;title&quot;&gt;Old Password&lt;/span&gt;
			&lt;span class=&quot;desc&quot;&gt;This is our awesome password field with default value. Try it out!&lt;/span&gt;
			&lt;input type=&quot;text&quot; name=&quot;oldpassword&quot; id=&quot;oldpassword&quot; value=&quot;tHis1$myP4swrd.&quot; /&gt;
		&lt;/label&gt;
		&lt;label&gt;
			&lt;span class=&quot;title&quot;&gt;Password&lt;/span&gt;
			&lt;span class=&quot;desc&quot;&gt;This is our awesome blank password field. Try it out!&lt;/span&gt;
			&lt;input type=&quot;password&quot; name=&quot;password&quot; id=&quot;password&quot; /&gt;
		&lt;/label&gt;
	&lt;/form&gt;
&lt;/div&gt;
</pre>
<p>Ok, then we need to call our magic jQuery and plugin files. Let&#8217;s do that:</p>
<pre class="brush: php; title: ; notranslate">
	&lt;script type=&quot;text/javascript&quot; src=&quot;http://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js&quot;&gt; // call jQuery from google! &lt;/script&gt;
	&lt;script type=&quot;text/javascript&quot; src=&quot;jquery.hp.js&quot;&gt; // call plugin &lt;/script&gt;
</pre>
<p>Well, let&#8217;s create our basic plugin file. You can see some tips about it in our <a href="http://www.1stwebdesigner.com/css/jquery-plugin-smooth-scrolling/">jQuery Smooth Table of Contents Plugin</a>, where we have a really simple structure.</p>
<pre class="brush: php; title: ; notranslate">
(function($){
 $.fn.hoverpass = function(options) {
	//Our default options
	var defaults = {
		bullet: &quot;&amp;bull;&quot;, //which should be the &quot;masking&quot; character
		font: &quot;'Lucida Console', monospace&quot;, //please just use MONOSPACE fonts
		bg: &quot;#fff&quot;, // background style for bullets
		free: &quot;&quot;, // add your own additional styling here
		freeBul: &quot;float: left; overflow: hidden;&quot;, // add your own additional styling for bullets here
		delay: 500, //how long it takes to create the bullet over the last character, in milliseconds
		delayHover: 3000, //how long it takes to hide again a hovered character
		animation: 500, //how long it takes the animation itself
		maxSize: 10 // maximum number of characters, to prevent  bullets exploding input's size
	};

	//let's extend our plugin with default or user options when defined
	var options = $.extend(defaults, options);

    return this.each(function() {
		//our action goes here
    });
 };
})(jQuery);
</pre>
<p>Above we defined our default variables, let me explain some of them a little bit:</p>
<ul>
<li><strong> bullet</strong> &#8211; Is what will mask our password. You can use any character but use just one character or HTML entity.</li>
<li><strong>font</strong> &#8211; This is really important, this plugin only works with monospaced fonts. Since in other types, each character has his own width, we can&#8217;t &#8220;mask&#8221; it.</li>
<li><strong>bg </strong>- If you use any background in your input, then you should apply it to your mask too, since it will be above the input.</li>
<li><strong>free </strong>- Here you should add margins in order to compensate any padding that your input has. Furthermore you should set your input&#8217;s font-size here.</li>
<li><strong>maxSize</strong> &#8211; This is important if your password field is too short. If you don&#8217;t adjust it you may get some extra bullets exploding your input&#8217;s size.</li>
</ul>
<p>At this point you have a basic plugin, that is called via $(elem).hoverpass(), defined by our second line $.fn.hoverpass = function(){}.<br />
I know, this name sucks. I would be glad if you send suggestions about better names :).</p>
<h2>Change our input type to text</h2>
<p>I don&#8217;t know if you&#8217;ve tried this before, but let me tell you something, you just can&#8217;t change the type of inputs. This happens due to security reasons, right? Well, seems that just IE will worry about it (you can do it via old JavaScript in real browsers). Anyway, what we have to do then is create a &#8220;clone&#8221; of current input without type property.<br />
There is several ways of doing this, I&#8217;ve done it this way:</p>
<pre class="brush: php; title: ; notranslate">
return this.each(function() {
	//let's declare some variables, many as a &quot;shortcut&quot; for options
	var  bullet = options.bullet,
			font = options.font,
			bg = options.bg,
			free = options.free,
			freeBul = options.freeBul,
			delay = options.delay,
			delayHover = options.delayHover,
			animation = options.animation,
			lastBul = &quot;&quot;;

	//since we just can't change a field's type, we'll remove it and append a brand new text input on it's place
	var oldElement = $(this); // caching element, much better performance
	var inputHTML = '&lt;input type=&quot;text&quot; style=&quot;font-family: '+  font +'; &quot; /&gt;'; //this is our basic input text, with our monopace font
	var input = oldElement.after(inputHTML).next(); //appending our simple text field with our styling (font-family) AND caching it as var &quot;input&quot;

	/****
		we are saying here:
			define the following variables: attr , i (zero), attrs (array with all oldElement attributes), l (size of attrs)
			while our counter (i) is smaller than attributes lenght (l) increase our counter and run this code
	*/
	for ( var attr, i=0 , attrs = oldElement[0].attributes , l =attrs.length ; i &lt; l ; i++){
		attr = attrs.item(i)
		if (attr.nodeName != &quot;type&quot; &amp;&amp; attr.nodeName != &quot;style&quot;) { //well, we defined our type as text and font-style!
			input.attr( attr.nodeName, attr.nodeValue );
		}
	}
	oldElement.remove(); // bye, bye input type=&quot;password&quot;!
});
</pre>
<h2>Create our mask and bullets</h2>
<p>Wow, at this point, when you define $(elem).hoverpass() it will turn into a monospaced text input. Pretty cool, huh? But we want more than this.</p>
<p>Now we will create our bullets container. The only really interesting thing in this two lines is that jQuery element caching again. You really should be using this simple technique:</p>
<pre class="brush: php; title: ; notranslate">
	// let the game begin
	var maskHTML = '&lt;div class=&quot;hpMask&quot; style=&quot;position: absolute; cursor: text; height: 1px; font-family: ' +  font + ' ; ' + free + ' &quot; /&gt;'; //our container with his styling
	var maskContainer = input.before(maskHTML).prev(); // appending our container for bullets with styling (font-family, free)
</pre>
<p>Now we&#8217;ll prepare our bullets HTML, since it will be used several times, and add some bullets when we have a &#8220;value&#8221; attribute defined.</p>
<pre class="brush: php; title: ; notranslate">
	var bulletHTML = &quot;&lt;span class='hpBullet' style='background: &quot; + bg + &quot;; &quot; + freeBul + &quot; '&gt;&quot;+ bullet + &quot; &lt;/span&gt; &quot;; // our bullets HTML with styling (bg, freeBul)
	var countBullet = 0; // this is our counter, it is important to prevent our mask to get bigger / smaller than our input or its maximum size

	//since we use it from different places, it's better to add it via function
	function addBullet() {
		// add our last bullet, but hidden, and show anything that isn't last bullet
		lastBul = maskContainer.append(bulletHTML).find(&quot;:last-child&quot;).hide();
		maskContainer.find(&quot;:not(:last-child)&quot;).each( function(){ $(this).show();  } );
		//start timer to show  lastBul
		lastBul.delay(delay).fadeIn(animation);
		countBullet++;
	}

	//first loop adding bullets when we have a default value
	for ( i=0 ; i &lt; input[0].value.length ; i++){
		addBullet();
	}
</pre>
<p>Well, at this point you should see again a textfield but if you have a value attribute defined, you&#8217;ll see a lot of bullets and the last one fading after one second. Although, if you type, nothing happens.</p>
<h2>It&#8217;s time to play with keyboard</h2>
<p>No, we won&#8217;t be taking music classes here :)</p>
<p>We now need to append new bullets every time something is typed in our password field, and remove one bullet if the pressed character is delete or backspace.</p>
<p>We could do this via keypress, keyup or keydown.</p>
<p>Thinking about it a little bit with keydown and keypress (they are very similar) we bind &#8220;pressing key&#8221; and with keyup we bind &#8220;releasing key&#8221;. Looking a little closer, you might notice that in our case it means that keydown/keypress is called before we have any change in our field&#8217;s value but keyup is called after any change occurs.</p>
<p>This is why we need to use keyup here. We have to look at our field&#8217;s value and see &#8220;hey, have you changed your size?&#8221; in order to append or remove bullets. This is because we could have several scenarios when user selects part of the password, press delete in the beginning of the field and much other things that would be too painful to bind as separated actions.</p>
<p>So, let&#8217;s do it:</p>
<pre class="brush: php; title: ; notranslate">
//let's bind all keydown and create / remove our bullets ; we need do use keydown in order to detect special characters in non-gecko browsers
	input.keyup(
		function(event) {
			//check if something was really typed
			if (input[0].value.length &gt; countBullet) {
				addBullet();
			} else { //ooops, delete or backspace?
				//then we check if something was really deleted
				while (input[0].value.length &lt; countBullet) {
					maskContainer.find(&quot;:last-child&quot;).remove();
					countBullet--;
				}
			}
		}
	);
</pre>
<h2>Finally, hover-revealing field!</h2>
<p>Well, now we just have to hide our bullet when someone hovers it. Kind of easy, right? Well, it isn&#8217;t that easy. It is because we have to hide our bullet, but we can&#8217;t lose it&#8217;s width, because if we do, our users would see only the last character of the password (not the ones in the middle). What we can do is to fade it to an insignificant opacity (like 10%) and then change it&#8217;s height to 1px, so we still have width.</p>
<p>Ok, now it&#8217;s just to use elem.hover() and we&#8217;re done, right? Again, no. This is because we have dynamically generated content we should use live() or delegate() to bind it. In my tests delegate had a much better performance, so we will do it this way:</p>
<pre class="brush: php; title: ; notranslate">
//hide bullets based on a jquery object
	function hideBullets(object) {
		object.stop().css({ &quot;height&quot;: &quot;auto&quot;}).animate({ opacity: 1 }, animation).removeClass(&quot;hpHiddenBullet&quot;);
	}
	//hover function for our bullets
	maskContainer.delegate(&quot;.hpBullet&quot;,  'hover',
		function(){
			var item = $(this);
			if (  item.hasClass(&quot;hpHiddenBullet&quot;) != true ) {
				hideBullets( $(&quot;.hpHiddenBullet&quot;) );
				item.stop().addClass(&quot;hpHiddenBullet&quot;).animate( { opacity: 0.01}, animation, function() { item.css({ &quot;height&quot;: &quot;1px&quot;}); } );
				setTimeout( function() {
					if (  item.hasClass(&quot;hpHiddenBullet&quot;) == true ) {
						hideBullets( item );
					}
				}, delayHover);
			}
		}
	);
</pre>
<h2>Are you hungry yet?</h2>
<p>Wow, hope you guys liked it. Maybe you&#8217;re not going to use this effect itself but I&#8217;m sure we have a lot of good snippets here that are worth using in other cases.</p>
<p>Talking about the final effect, what do you think about it? Have you seen a better alternative?</p>
<p>Show us your opinion and let&#8217;s find what could be the very best implementation to our users!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.1stwebdesigner.com/css/jquery-hover-reveal-masked-password/feed/</wfw:commentRss>
		<slash:comments>18</slash:comments>
		</item>
		<item>
		<title>17 CSS/HTML Effects with Cross-Browsing Alternatives</title>
		<link>http://www.1stwebdesigner.com/css/17-css-html-effects/</link>
		<comments>http://www.1stwebdesigner.com/css/17-css-html-effects/#comments</comments>
		<pubDate>Fri, 22 Jul 2011 10:00:01 +0000</pubDate>
		<dc:creator>Rochester Oliveira</dc:creator>
				<category><![CDATA[Coding]]></category>
		<category><![CDATA[HTML & CSS]]></category>
		<category><![CDATA[coding]]></category>
		<category><![CDATA[css effects]]></category>
		<category><![CDATA[html]]></category>
		<category><![CDATA[text shadow]]></category>
		<category><![CDATA[web design]]></category>

		<guid isPermaLink="false">http://www.1stwebdesigner.com/?p=50443</guid>
		<description><![CDATA[Well, we surely have a lot of different ways to achieve similar effects and with CSS the hardest part is to make it look good in almost every browser. You don&#8217;t need to reinvent the wheel every time, if you get one good snippet that does what you want (and you understand what is happening) [...]]]></description>
			<content:encoded><![CDATA[<p>Well, we surely have a lot of different ways to achieve similar effects and with CSS the hardest part is to make it look good in almost every browser.</p>
<p>You don&#8217;t need to reinvent the wheel every time, if you get one good snippet that does what you want (and you understand what is happening) you don&#8217;t need to reinvent it every time you need a simple round corner, right?</p>
<p>Thus, our point here is to collect some cool CSS effects that you should be using:</p>
<p>• Min / Max width (IE included)<br />
• RGBA (IE included)<br />
• Opacity (IE included)<br />
• Image rotation / scaling (IE included)<br />
• FullScreen Background (IE included)<br />
• Background pattern or bullet without image file<br />
• Text Shadow (IE included)<br />
• Multiple borders (IE included)<br />
• Box Shadows (IE included)<br />
• Rounded corners<br />
• Screen reader only accessible content<br />
• Don&#8217;t use negative text-indent<br />
• Clearfix (IE included)<br />
• @font-face (IE included)<br />
• Pull quotes without image<br />
• CSS for iPhone4 (higher resolution)<br />
• CSS landscape / portrait orientation for mobiles</p>
<p>So, Let&#8217;s rock!</p>
<p><span id="more-50443"></span></p>
<h2>Min / Max width (IE included)</h2>
<p>Well, many of you are used to just replace the lack of min / max width / height for IE with fixed dimensions, right? But you don&#8217;t need to do it anymore. IE is not a strict standards browser and sometimes we can take advantage of this to code things that would be awful to see in standard CSS code.</p>
<p>You can, in this case, insert some IE expressions (basically, JavaScript code) to check current body width and adjust element&#8217;s width as follows:</p>
<pre class="brush: css; title: ; notranslate">
#content {
	width: expression(document.body.clientWidth &lt; 762? &quot;760px&quot; : document.body.clientWidth &gt; 1242? &quot;1240px&quot; : &quot;auto&quot;);
	min-width: 760px;
	max-width: 1240px;
}
</pre>
<h2>RGBA (IE included)</h2>
<p>This time we will need some IE filters to get the job done. You&#8217;ll have the standard markup, IE6 correction and IE8 correction.</p>
<p>IE corrections is based on gradient filter, that actually we put just one color to the beginning and the end, and BAM! We have a pretty RGBA background.</p>
<p>The first two digits should be the opacity and the last one should be the color itself. Don&#8217;t know why, it just don&#8217;t get the opacity right&#8230; Maybe its just a bug inside a bug :)</p>
<pre class="brush: css; title: ; notranslate">
.element {
  background-color: transparent;
  background-color: rgba(255, 255, 255,0.8);
  filter:progid:DXImageTransform.Microsoft.gradient(startColorstr=#80ffffff,endColorstr=#80ffffff);
  -ms-filter: &quot;progid:DXImageTransform.Microsoft.gradient(startColorstr=#80ffffff,endColorstr=#80ffffff)&quot;;
}
</pre>
<h2>Opacity (IE included)</h2>
<p>Wow, filters again! But this time we have a different syntax for IE8 and earlier versions. And again be sure to put khtml, moz and standard declarations.</p>
<pre class="brush: css; title: ; notranslate">
.selector {
	ms-filter: &quot;progid:DXImageTransform.Microsoft.Alpha(Opacity=50)&quot;; /* internet explorer 8 */
	filter: alpha(opacity=50); /* internet explorer 5~7 */
	-khtml-opacity: 0.5;      /* khtml, old safari */
	-moz-opacity: 0.5;       /* mozilla, netscape */
	opacity: 0.5;           /* fx, safari, opera */
}
</pre>
<h2>Image rotation / scaling (IE included)</h2>
<p>Another pretty cool and virtually unused feature is image rotation / scaling. There is another filter that allows you to rotate images, but unfortunately it just allows you 90º increments.</p>
<p>Although you can also mirror images, that makes cool image editing possible to almost every real browser and IE. For real browsers we will use the transform property with each vendor prefix.</p>
<pre class="brush: css; title: ; notranslate">
	img {
		transform:
			rotate(180deg)
			scale(-1, 1);

		/* for firefox, safari, chrome, etc. */
		-webkit-transform:
			rotate(180deg)
			scale(-1, 1);
		-moz-transform:
			rotate(180deg)
			scale(-1, 1);

		/* for ie */
		filter: progid:DXImageTransform.Microsoft.BasicImage(rotation=2, mirror=1);

		/* opera */
		-o-transform:
			rotate(180deg)
			scale(-1, 1);
	}
</pre>
<h2>Fullscreen Background (IE included)</h2>
<p>Sometimes we just need a quick way to get full screen backgrounds. Well, hope you don&#8217;t use JavaScript just to do this, because you can do it with a few lines of CSS.</p>
<p>The magic here is to set a div that goes fullscreen and inside it you can put a landscape, portrait or full sized image.</p>
<pre class="brush: css; title: ; notranslate">
	.content {
		position: relative;
		width: 760px;
		z-index: 10;
	 }
	 .background {
		top: 0;
		left: 0;
		width: 100%;
		height: 100%;
		position: absolute;
		z-index:2;
	 }
		.portrait {
			height: 100%;
		}
		.landscape {
			width: 100%;
		}
		.full {
			width: 100%;
			height: 100%;
		}
</pre>
<pre class="brush: xml; title: ; notranslate">
&lt;div class=&quot;content&quot;&gt;
	&lt;p&gt;aaaaaaaaaaaaaaaaaaaaaaaaaaaa&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&quot;background&quot;&gt;
	&lt;img class=&quot;full | portrait | landscape&quot; src=&quot;imgURL&quot; alt=&quot;&quot; /&gt;
&lt;/div&gt;
</pre>
<h2>Background pattern or bullet without image file</h2>
<p>Pretty sad that IE doesn&#8217;t allows you to use base64 encoding instead of real files. The best part is to use it for mobiles, since it saves you some http requests and precious time.<br />
I&#8217;ve used it for a custom list style image without images. I just generated the base64 from <a href="http://patternfy.com">Patternfy</a> and pasted it in my CSS, like this:</p>
<pre class="brush: css; title: ; notranslate">
	 ul {
		list-style-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAQAAAAJCAYAAAAVb42gAAAAFklEQVQImWNgIAro56z9T4Ygbg5BAABTdwtkrDt7swAAAABJRU5ErkJggg==);
	 }
</pre>
<h2>Text Shadow (IE included)</h2>
<p>Again we will need some IE filters. But this time IE filters can destroy your font&#8217;s readability, so try not to use it too much and preferably, only when working with larger fonts.</p>
<pre class="brush: css; title: ; notranslate">
	p {
		text-shadow: #000000 0 0 1px;
		zoom:1;
		filter: progid:DXImageTransform.Microsoft.Glow(Color=#000000,Strength=1);

		-ms-filter: &quot;progid:DXImageTransform.Microsoft.dropshadow(OffX=-1, OffY=-1, Color=#000000)progid:DXImageTransform.Microsoft.dropshadow(OffX=0, OffY=-1, Color=#000000)progid:DXImageTransform.Microsoft.dropshadow(OffX=1, OffY=-1, Color=#000000)progid:DXImageTransform.Microsoft.dropshadow(OffX=1, OffY=0, Color=#000000)progid:DXImageTransform.Microsoft.dropshadow(OffX=1, OffY=1, Color=#000000)progid:DXImageTransform.Microsoft.dropshadow(OffX=0, OffY=1, Color=#000000)progid:DXImageTransform.Microsoft.dropshadow(OffX=-1, OffY=1, Color=#000000)progid:DXImageTransform.Microsoft.dropshadow(OffX=-1, OffY=0, Color=#000000)&quot;;
	}
</pre>
<h2>Multiple borders (IE included)</h2>
<p>When you want more than one border, for real browsers you&#8217;ll need to use an outline or :before and :after elements. For IE you could use filters to gain some an extra border.</p>
<pre class="brush: css; title: ; notranslate">
	div {
		-ms-filter: &quot;progid:DXImageTransform.Microsoft.Shadow(color=#212121,direction=180,strength=0)&quot;; /* IE 8 */
		filter: progid:DXImageTransform.Microsoft.Shadow(color=#212121,direction=180,strength=0); /* IE 7- */
	}
	div:before {
		position: absolute;
		top: 0px;
		width: 100%;
		height: 100%;
		border-top: 1px solid #212121; /* top border! */
		content: '';
	}
	div:after {
		position: absolute;
		width: 100%;
		height: 100%;
		top: 1px;
		border-bottom: 1px solid #212121; /* bottom border! */
		content: '';
	}
</pre>
<h2>Box Shadows (IE included)</h2>
<p>The same filter we&#8217;ve used to create a second border can be used to generate box shadows. Be aware that this filter can mess up an element&#8217;s width, so if you want to use it with any grid system, prepare for the headache.</p>
<pre class="brush: css; title: ; notranslate">
	.shadow {
	    -moz-box-shadow: 0 0 4px #000;
		-webkit-box-shadow: 0 0 4px #000;
		-ms-filter: &quot;progid:DXImageTransform.Microsoft.Glow(color=#666666,strength=3)&quot;;
		filter:
				progid:DXImageTransform.Microsoft.Shadow(color=#666666,direction=0,strength=3)
				progid:DXImageTransform.Microsoft.Shadow(color=#666666,direction=90,strength=3)
				progid:DXImageTransform.Microsoft.Shadow(color=#666666,direction=180,strength=3)
				progid:DXImageTransform.Microsoft.Shadow(color=#666666,direction=270,strength=3);
		box-shadow: 0 0 4px #000;
	}
</pre>
<h2>Rounded corners</h2>
<p>The bad part about almost-standard properties is that each browser implements its syntax differently. So for round corners we have a pretty strange behavior, where standards browsers have different ways to say same thing:</p>
<pre class="brush: css; title: ; notranslate">
.rounded  {
	-moz-border-radius: 10px; /* gecko */
	-webkit-border-radius: 10px; /* webkit */
	border-radius: 10px; /* CSS3 standard */
	-khtml-border-radius: 10px; /* old konkeror */

	-webkit-border-bottom-right-radius: 10px;
	-webkit-border-bottom-left-radius: 10px;
	-webkit-border-top-right-radius: 10px;
	-webkit-border-top-left-radius: 10px;

	-khtml-border-radius-bottomright: 10px;
	-khtml-border-radius-bottomleft: 10px;
	-khtml-border-radius-topright: 10px;
	-khtml-border-radius-topleft: 10px;

	-moz-border-radius-bottomright: 10px;
	-moz-border-radius-bottomleft: 10px;
	-moz-border-radius-topright: 10px;
	-moz-border-radius-topleft: 10px;

	border-bottom-right-radius: 10px;
	border-bottom-left-radius: 10px;
	border-top-right-radius: 10px;
	border-top-left-radius: 10px;
 }
</pre>
<h2>Screen reader only accessible content</h2>
<p>Sometimes you want to improve the accessibility of your site, so you put some fancy links like &#8220;Jump to content&#8221; or &#8220;Jump to navigation&#8221;. So you just put &#8220;display: none&#8221; or &#8220;visibility: hidden&#8221; and hope it works, right? Well, it doesn&#8217;t. Some tests show that many screen readers just ignore the display:none or visibility: hidden part, so you don&#8217;t have any accessibility improvement.</p>
<p>What you can do instead is to use position absolute and hide this content above browsers visible area. But you have some risks on this technique, since it hides content, Google can consider it gray or black hat.</p>
<pre class="brush: css; title: ; notranslate">
.hidden  {
	position: absolute;
	top: -10000px;
	left: -10000px;
 }
</pre>
<h2>Don&#8217;t use negative text-indent</h2>
<p>Since we&#8217;re talking about hidden content, take one more note, never use negative text-indent again. This is a known technique so you have a lot of SEO downsides by using it, since many bots can recognize it nowadays.<br />
Just use alt attribute, that is much safer than hide content.</p>
<pre class="brush: xml; title: ; notranslate">
&lt;h1&gt;&lt;img src=&quot;myLogo&quot; alt=&quot;My company&quot; /&gt;&lt;/h1&gt;
</pre>
<h2>Clearfix (IE included)</h2>
<p>Many of you know about .clearfix method for correcting heights when you use floats. Well, in many of these cases, that amount of code could be replaced by just two lines:</p>
<pre class="brush: css; title: ; notranslate">
	.clearfix {
		zoom:1;
		overflow:hidden;
	}
</pre>
<h2>@font-face (IE included)</h2>
<p>If you&#8217;re still using cufon just because you don&#8217;t trust @font-face, think again.<br />
Font Squirrel provides an amazing <a href="http://www.fontsquirrel.com/fontface/generator">@font-face generator service</a>, that allows you to put really good looking fonts in your site without worrying about all that JavaScript stuff.<br />
The final code provided is something like this:</p>
<pre class="brush: css; title: ; notranslate">
@font-face {
    font-family: 'MandatoryRegular';
    src: url('font/mandator-webfont.eot');
    src: url('font/mandator-webfont.eot?#iefix') format('embedded-opentype'),
         url('font/mandator-webfont.woff') format('woff'),
         url('font/mandator-webfont.ttf') format('truetype'),
         url('font/mandator-webfont.svg#MandatoryRegular') format('svg');
    font-weight: normal;
    font-style: normal;
}
</pre>
<h2>Pull quotes without image</h2>
<p>We talked about this before, but it is possible to <a href="http://www.1stwebdesigner.com/css/css-tricks-quotes-tooltips/">create curly quotes without any image</a>. And it is not that hard. You just need a :before and blockquote:</p>
<pre class="brush: css; title: ; notranslate">
	blockquote:before {
		display: block;
		float: left;
		margin: 10px 15px 0 0;
		font-size: 100px; /* let's make it a big quote! */
		content: open-quote; /* here we define our :before as a smart quote. It could be any content, even the HTML entity alternative to this opening quote, that is “ */
		color: #bababa;
		text-shadow: 0 1px 1px #909090;
	}
</pre>
<h2>CSS for iPhone4 (higher resolution)</h2>
<p>As time goes by we get more and more powerful mobile devices. It is a good practice to give create a mobile version, with reduced images and overall files size, but we have also to give a better experience for the ones with newer devices.<br />
Since iPhone4 has a higher resolution, if you don&#8217;t provide a better (and larger) version of you logo, for example, your users will get a blurry version of it. This is a problem that can be solved with a very few lines:</p>
<pre class="brush: css; title: ; notranslate">
@media handheld, only screen and (max-width: 767px) {
	.logo {
		/* common low-res and low-size, of course */
		background: url(logo.jpg) no-repeat;
	}
}

@media only screen and (-webkit-min-device-pixel-ratio: 2) {
	.logo {
		background: url(logo2x.jpg) no-repeat;
		background-size: 212px 303px;
	}
}
</pre>
<h2>CSS landscape / portrait orientation for mobiles</h2>
<p>This is a nice starting point for correcting layout bugs in each version of each layout mode for many mobiles, <a href="http://www.stuffandnonsense.co.uk/blog/about/hardboiled_css3_media_queries">provided by stuffAndNoise</a></p>
<pre class="brush: css; title: ; notranslate">
	/* Smartphones (portrait and landscape) ----------- */
	@media only screen
	and (min-device-width : 320px)
	and (max-device-width : 480px) {
		/* Styles */
	}

	/* Smartphones (landscape) ----------- */
	@media only screen
	and (min-width : 321px) {
		/* Styles */
	}

	/* Smartphones (portrait) ----------- */
	@media only screen
	and (max-width : 320px) {
		/* Styles */
	}

	/* iPads (portrait and landscape) ----------- */
	@media only screen
	and (min-device-width : 768px)
	and (max-device-width : 1024px) {
		/* Styles */
	}

	/* iPads (landscape) ----------- */
	@media only screen
	and (min-device-width : 768px)
	and (max-device-width : 1024px)
	and (orientation : landscape) {
		/* Styles */
	}

	/* iPads (portrait) ----------- */
	@media only screen
	and (min-device-width : 768px)
	and (max-device-width : 1024px)
	and (orientation : portrait) {
		/* Styles */
	}

	/* Desktops and laptops ----------- */
	@media only screen
	and (min-width : 1224px) {
		/* Styles */
	}

	/* Large screens ----------- */
	@media only screen
	and (min-width : 1824px) {
		/* Styles */
	}

	/* iPhone 4 ----------- */
	@media
	only screen and (-webkit-min-device-pixel-ratio : 1.5),
	only screen and (min-device-pixel-ratio : 1.5) {
		/* Styles */
	}
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.1stwebdesigner.com/css/17-css-html-effects/feed/</wfw:commentRss>
		<slash:comments>51</slash:comments>
		</item>
		<item>
		<title>50 New And Crazy Cool jQuery Plugins From Year 2011</title>
		<link>http://www.1stwebdesigner.com/css/jquery-plugins-2011/</link>
		<comments>http://www.1stwebdesigner.com/css/jquery-plugins-2011/#comments</comments>
		<pubDate>Sun, 10 Jul 2011 11:00:57 +0000</pubDate>
		<dc:creator>Daniels Mekšs</dc:creator>
				<category><![CDATA[Coding]]></category>
		<category><![CDATA[JS & AJAX]]></category>
		<category><![CDATA[Tools]]></category>
		<category><![CDATA[Web Design]]></category>
		<category><![CDATA[2011]]></category>
		<category><![CDATA[cool]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[jquery]]></category>
		<category><![CDATA[plugins]]></category>
		<category><![CDATA[webdesign]]></category>

		<guid isPermaLink="false">http://www.1stwebdesigner.com/?p=49887</guid>
		<description><![CDATA[With 2011 a little over half over it&#8217;s the right time to look at, and uncover, the current trends of web design and development. It&#8217;s sure been a helluva ride for jQuery and it&#8217;s growth just doesn&#8217;t stop. With more than 40% of websites using jQuery now it&#8217;s no longer possible to ignore this efficient, [...]]]></description>
			<content:encoded><![CDATA[<p>With 2011 a little over half over it&#8217;s the right time to look at, and uncover, the current trends of web design and development. It&#8217;s sure been a helluva ride for jQuery and it&#8217;s growth just doesn&#8217;t stop. With more than 40% of websites using jQuery now it&#8217;s no longer possible to ignore this efficient, powerful and lightweight tool.</p>
<p>jQuery gives developers the chance to enrich websites with amazing elements without the need to write dozens of lines of code. This article presents 50 advanced, cutting-edge yet simple jQuery plugins that will enhance your web experience drastically.<span id="more-49887"></span></p>
<h3>1. <a href="http://javan.us/jbar/">jbar</a></h3>
<p><a href="http://javan.us/jbar/"><img src="http://cdn1.1stwebdesigner.com/wp-content/uploads/2011/07/jquery-tools-2011/jbar-new-cool-jquery-plugins-2011.jpg" alt="Jbar-new-cool-jquery-plugins-2011" border="0" /></a></p>
<p>jbar is a jQuery plugin that transforms an unordered list <code>&lt;ul&gt;</code> into a toolbar with dropdown menus.</p>
<h3>2. <a href="http://www.htmldrive.net/items/show/895/-Drop-down-TabMenu-with-AJAX">e24TabMenu</a></h3>
<p><img src="http://cdn1.1stwebdesigner.com/wp-content/uploads/2011/07/jquery-tools-2011/tabmenu-new-cool-jquery-plugins-2011.jpg" alt="Tabmenu-new-cool-jquery-plugins-2011" border="0" /></p>
<p>e24TabMenu is a plugin written for scriptaculous. It is a tab menu that expands and collapses smoothly.</p>
<h3>2.1. <a href="http://codecanyon.net/item/royalslider-touchenabled-jquery-image-gallery/461126?ref=1stwebdesigner">RoyalSlider – Touch-Enabled jQuery Image Gallery</a></h3>
<p>RoyalSlider is easy to use jQuery image gallery with animated captions and touch support for mobile devices. Easily add unlimited number of slides and captions. Use it as image slider, image gallery, banner rotator, banner ads, or even presentation.</p>
<p><a href="http://codecanyon.net/item/royalslider-touchenabled-jquery-image-gallery/461126?ref=1stwebdesigner"><img class="alignnone" title="Royal Slideshow jQuery Image Gallery" src="http://3.s3.envato.com/files/5965530/5.0_BigImagePreview.png" alt="" width="590" height="300" /></a></p>
<p><a href="http://codecanyon.net/item/royalslider-touchenabled-jquery-image-gallery/full_screen_preview/461126?ref=1stwebdesigner">View Demo</a></p>
<h3>3. <a href="http://www.htmldrive.net/items/show/884/-Simple-jQuery-Fluid-Thumbnail-menu-Bar-">Simple jQuery Fluid Thumbnail Menu Bar </a></h3>
<p><a href="http://www.htmldrive.net/items/show/884/-Simple-jQuery-Fluid-Thumbnail-menu-Bar-"><img src="http://cdn1.1stwebdesigner.com/wp-content/uploads/2011/07/jquery-tools-2011/fluid-thumbnail-new-cool-jquery-plugins-2011.jpg" alt="Fluid-thumbnail-new-cool-jquery-plugins-2011" border="0" /></a></p>
<p>The idea of a fluid thumbnail bar is simple: create a list of thumbnails within a space where the overflow can be flipped through page by page.</p>
<h3>4. <a href="http://www.scriptbreaker.com/javascript/script/JQuery-multi-level-accordion-menu">Accordion Multilevel Menu</a></h3>
<p><a href="http://www.scriptbreaker.com/javascript/script/JQuery-multi-level-accordion-menu"><img src="http://cdn1.1stwebdesigner.com/wp-content/uploads/2011/07/jquery-tools-2011/accordion-new-cool-jquery-plugins-2011.jpg" alt="Accordion-new-cool-jquery-plugins-2011" border="0" /></a></p>
<p>The plugin has a boolean initialization option accordion. If you set this value to &#8220;true&#8221; the menu behaves as an <strong>accordion menu</strong>. The irrelevant menu items are closed while the relevant slides open.</p>
<h3>5. <a href="http://jamielottering.github.com/DropKick/">DropKick</a></h3>
<p><a href="http://jamielottering.github.com/DropKick/"><img src="http://cdn1.1stwebdesigner.com/wp-content/uploads/2011/07/jquery-tools-2011/dropkick-new-cool-jquery-plugins-2011.jpg" alt="Dropkick-new-cool-jquery-plugins-2011" border="0" /></a></p>
<p>Creating custom dropdowns is usually a tedious process that requires a ton of extra setup time. Oftentimes lacking conveniences that native dropdowns have such as keyboard navigation. DropKick removes the tedium and lets you focus on making the menu look good.</p>
<h3>6. <a href="https://github.com/trepmag/jrac">jQuery Resize And Crop</a></h3>
<p><a href="https://github.com/trepmag/jrac"><img src="http://cdn1.1stwebdesigner.com/wp-content/uploads/2011/07/jquery-tools-2011/crop-resize-new-cool-jquery-plugins-2011.jpg" alt="Crop-resize-new-cool-jquery-plugins-2011" border="0" /></a></p>
<p>jQuery Resize And Crop (jrac) is a jQuery plugin that build a viewport around a given image permitting a person to visually resize an image and place a crop. Then it is<br />
possible to use the coordinates data for any purpose.</p>
<h3>7. <a href="http://www.amazingthings.in/2011/07/cloud-zoom-jquery-image-zoom-plugin.html">Cloud Zoom</a></h3>
<p><a href="http://www.amazingthings.in/2011/07/cloud-zoom-jquery-image-zoom-plugin.html"><img src="http://cdn1.1stwebdesigner.com/wp-content/uploads/2011/07/jquery-tools-2011/cloud-zoom-new-cool-jquery-plugins-2011.jpg" alt="Cloud-zoom-new-cool-jquery-plugins-2011" border="0" /></a></p>
<p>Cloud Zoom is a jQuery image zoom plugin, a comparable alternative to products such as Magic Zoom. Compared to the popular jQZoom plugin, Cloud Zoom is smaller, has more features and more robust compatibility across browsers.</p>
<h3>8. <a href="http://www.htmldrive.net/items/show/886/Useful-image-hover-slide-effect-with-jQuery">Simple jQuery Image Hover Effect</a></h3>
<p><a href="http://www.htmldrive.net/items/show/886/Useful-image-hover-slide-effect-with-jQuery"><img src="http://cdn1.1stwebdesigner.com/wp-content/uploads/2011/07/jquery-tools-2011/image-hover-new-cool-jquery-plugins-2011.jpg" alt="Image-hover-new-cool-jquery-plugins-2011" border="0" /></a></p>
<p>This is a simple technique to animate an image when hovering using jQuery’s animate() effect.</p>
<h3>9. <a href="http://cssglobe.com/post/9711/jquery-plugin-easy-image-zoom">Easy Image Zoom</a></h3>
<p><a href="http://cssglobe.com/post/9711/jquery-plugin-easy-image-zoom"><img src="http://cdn1.1stwebdesigner.com/wp-content/uploads/2011/07/jquery-tools-2011/image-zoom-new-cool-jquery-plugins-2011.jpg" alt="Image-zoom-new-cool-jquery-plugins-2011" border="0" /></a></p>
<p>Easy Image Zoom gives you the opportunity to see large details of the product while moving the cursor over a medium sized image.</p>
<h3>10. <a href="http://www.dailycoding.com/Posts/imagelens__a_jquery_plugin_for_lens_effect_image_zooming.aspx">ImageLens</a></h3>
<p><a href="http://www.dailycoding.com/Posts/imagelens__a_jquery_plugin_for_lens_effect_image_zooming.aspx"><img src="http://cdn1.1stwebdesigner.com/wp-content/uploads/2011/07/jquery-tools-2011/image-lens-new-cool-jquery-plugins-2011.jpg" alt="Image-lens-new-cool-jquery-plugins-2011" border="0" /></a></p>
<p><span id="ctl00_contentPlaceHolderMain_descriptionLabel">Use this jQuery plug-in to add lens style zooming effect to an image,</span></p>
<h3>11. <a href="http://www.liam-galvin.co.uk/imageselect/">ImageSelect</a></h3>
<p><a href="http://www.liam-galvin.co.uk/imageselect/"><img src="http://cdn1.1stwebdesigner.com/wp-content/uploads/2011/07/jquery-tools-2011/image-select-new-cool-jquery-plugins-2011.jpg" alt="Image-select-new-cool-jquery-plugins-2011" border="0" /></a></p>
<p>ImageSelect is a jQuery plugin that allows the user to select an image by means of a nice looking dropdown.</p>
<h3>12. <a href="http://dannyvankooten.com/jquery-plugins/mapz/">jQuery Mapz</a></h3>
<p><a href="http://dannyvankooten.com/jquery-plugins/mapz/"><img src="http://cdn1.1stwebdesigner.com/wp-content/uploads/2011/07/jquery-tools-2011/maps-new-cool-jquery-plugins-2011.jpg" alt="Maps-new-cool-jquery-plugins-2011" border="0" /></a></p>
<p>With Mapz you can easily create draggable image maps by just calling one function and by using some simple and clean HTML mark-up.</p>
<h3>13. <a href="http://blueimp.github.com/jQuery-Image-Gallery/">jQuery Image Gallery</a></h3>
<p><a href="http://blueimp.github.com/jQuery-Image-Gallery/"><img src="http://cdn1.1stwebdesigner.com/wp-content/uploads/2011/07/jquery-tools-2011/image-gallery-new-cool-jquery-plugins-2011.jpg" alt="Image-gallery-new-cool-jquery-plugins-2011" border="0" /></a></p>
<p>Image Gallery with Lightbox effect and slideshow functionality for jQuery UI.</p>
<h3>14. <a href="http://jbhslider.projects.bodin-hullin.net/">JbhSlider</a></h3>
<p><a href="http://jbhslider.projects.bodin-hullin.net/"><img src="http://cdn1.1stwebdesigner.com/wp-content/uploads/2011/07/jquery-tools-2011/jbhslider-new-cool-jquery-plugins-2011.jpg" alt="Jbhslider-new-cool-jquery-plugins-2011" border="0" /></a></p>
<p>JbhSlider is a fully customizable slider. You can add/remove navigation or pagination. You can set the effect, the duration and the functions after/before.</p>
<h3>15. <a href="http://www.gobwas.com/sbanjo">jQuery.slideBanjo</a></h3>
<p><a href="http://www.gobwas.com/sbanjo"><img src="http://cdn1.1stwebdesigner.com/wp-content/uploads/2011/07/jquery-tools-2011/slidebanjo-new-cool-jquery-plugins-2011.jpg" alt="Slidebanjo-new-cool-jquery-plugins-2011" border="0" /></a></p>
<p>jQuery.slideBanjo is a plugin, that shows pretty slides on your site. Supports background loading of pictures, simple to customize, full documentation. Compatible with IE7 and higher.</p>
<h3>15.1. <a href="http://codecanyon.net/item/estro-jquery-ken-burns-swipe-effect-slider/235111?ref=1stwebdesigner">Estro &#8211; jQuery Ken Burns &amp; swipe effect slider</a></h3>
<p>This jQuery plugin uses unobtrusive javascript to transform a block of simple HTML markup into a gorgeous elegant slider, which can be completely customized using HTML5 data attributes. The markup is valid HTML5 and SEO optimized, with all content always being available to search engines. When using this plugin, your page layout will be consistent even if javascript has been disabled.</p>
<p>This slider includes a smooth and powerful Ken Burns effect which is completely configurable and compatible with all major browsers (including ie7 to ie9, Firefox Chrome, Opera, Safari) and mobile platforms like iphone / ipad. If the Ken Burns effect is not your thing, that’s OK because the “Estro” slider also includes a 2-way “Swipe” mode with configurable transitions.</p>
<p><a href="http://codecanyon.net/item/estro-jquery-ken-burns-swipe-effect-slider/235111?ref=1stwebdesigner"><img class="alignnone" title="jQuery Slide Swipe Gallery" src="http://0.s3.envato.com/files/2350553/01_preview.jpg" alt="" width="590" height="300" /></a></p>
<p><a href="http://codecanyon.net/item/estro-jquery-ken-burns-swipe-effect-slider/full_screen_preview/235111?ref=1stwebdesigner">View Demo</a></p>
<h3>16. <a href="http://slidesjs.com/">Slides</a></h3>
<p><a href="http://slidesjs.com/"><img src="http://cdn1.1stwebdesigner.com/wp-content/uploads/2011/07/jquery-tools-2011/slides-new-cool-jquery-plugins-2011.jpg" alt="Slides-new-cool-jquery-plugins-2011" border="0" /></a></p>
<p>Slides is a slideshow plugin for jQuery that is built with simplicity in mind. Packed with a useful set of features to help novice and advanced developers alike create elegant and user-friendly slideshows.</p>
<h3>17. <a href="http://ekallevig.com/jshowoff/">jShowOff</a></h3>
<p><a href="http://ekallevig.com/jshowoff/"><img src="http://cdn1.1stwebdesigner.com/wp-content/uploads/2011/07/jquery-tools-2011/jshowoff-new-cool-jquery-plugins-2011.jpg" alt="Jshowoff-new-cool-jquery-plugins-2011" border="0" /></a></p>
<p>jShowOff is a jQuery plugin for creating a rotating content module. It works by creating &#8216;slides&#8217; from the child elements (eg. &lt;li&gt;) inside a specified wrapper element (eg. &lt;ul&gt;) on which .jshowoff() is invoked. It then rotates through the slides, with options for controls, links, and more.</p>
<h3>18. <a href="http://baijs.nl/tinycarousel/">Tiny Carousel</a></h3>
<p><a href="http://baijs.nl/tinycarousel/"><img src="http://cdn1.1stwebdesigner.com/wp-content/uploads/2011/07/jquery-tools-2011/tiny-carousel-new-cool-jquery-plugins-2011.jpg" alt="Tiny-carousel-new-cool-jquery-plugins-2011" border="0" /></a></p>
<p>Tiny Carousel is a lightweight carousel for sliding html based content. It was built using the javascript jQuery library. Tiny Carousel was designed to be a dynamic lightweight utility that gives webdesigners a powerfull way of enhancing a websites user interface.</p>
<h3>19. <a href="http://www.greepit.com/2011/06/gslider-lightweight-versatile-and-interactive-jquery-image-slider/">gSlider</a></h3>
<p><a href="http://www.greepit.com/2011/06/gslider-lightweight-versatile-and-interactive-jquery-image-slider/"><img src="http://cdn1.1stwebdesigner.com/wp-content/uploads/2011/07/jquery-tools-2011/gslider-new-cool-jquery-plugins-2011.jpg" alt="Gslider-new-cool-jquery-plugins-2011" border="0" /></a></p>
<p>gSlider is an interactive image slider built on jQuery. It is versatile, lightweight and easy to implement in any website or web applications.</p>
<h3>20. <a href="http://projects.craftedpixelz.co.uk/craftyslide/">Craftyslide</a></h3>
<p><a href="http://projects.craftedpixelz.co.uk/craftyslide/"><img src="http://cdn1.1stwebdesigner.com/wp-content/uploads/2011/07/jquery-tools-2011/craftyslide-new-cool-jquery-plugins-2011.jpg" alt="Craftyslide-new-cool-jquery-plugins-2011" border="0" /></a></p>
<p id="intro">Craftyslide is a tiny (just 2kb) slideshow built on jQuery. Craftyslide aims to be different, by providing a simple, no-frills method of displaying images; packaged into a small, clean and efficient plugin.</p>
<h3>21. <a href="https://bitbucket.org/mjs7231/jquery-wysiwym">JQuery Wysiwym</a></h3>
<p><a href="https://bitbucket.org/mjs7231/jquery-wysiwym"><img src="http://cdn1.1stwebdesigner.com/wp-content/uploads/2011/07/jquery-tools-2011/wysiwym-new-cool-jquery-plugins-2011.jpg" alt="Wysiwym-new-cool-jquery-plugins-2011" border="0" /></a></p>
<p>JQuery-Wysiwym is a wysiwym (What You See Is What You Mean) editor. It is not meant to be used to output HTML, it simply helps with the desired markup syntax. Currently supported are Markdown, MediaWiki, and BBCode.</p>
<h3>22. <a href="http://leanmodal.finelysliced.com.au/">leanModal</a></h3>
<p><a href="http://leanmodal.finelysliced.com.au/"><img src="http://cdn1.1stwebdesigner.com/wp-content/uploads/2011/07/jquery-tools-2011/ieanmodal-new-cool-jquery-plugins-2011.jpg" alt="Ieanmodal-new-cool-jquery-plugins-2011" border="0" /></a></p>
<p>A super simple modal window plugin that works with your CSS. Perfect for hidden page content. Uber light at just 780 bytes (minified). Flexible width &amp; height, image free, supports multiple instances on one page. Great for login, sign up &amp; alert panels, etc.</p>
<h3>23. <a href="http://code.google.com/p/jquery-preloader/">jQuery-preloader</a></h3>
<p><a href="http://code.google.com/p/jquery-preloader/"><img src="http://cdn1.1stwebdesigner.com/wp-content/uploads/2011/07/jquery-tools-2011/preloader-new-cool-jquery-plugins-2011.jpg" alt="Preloader-new-cool-jquery-plugins-2011" border="0" /></a></p>
<p>This jQuery plugin preloads CSS, JS, HTML and images with visual loader, fast and very small (~2Kb).</p>
<h3>24. <a href="http://stefangabos.ro/jquery/zebra-dialog/">Zebra_Dialog</a></h3>
<p><a href="http://stefangabos.ro/jquery/zebra-dialog/"><img src="http://cdn1.1stwebdesigner.com/wp-content/uploads/2011/07/jquery-tools-2011/zebra-dialog-new-cool-jquery-plugins-2011.jpg" alt="Zebra-dialog-new-cool-jquery-plugins-2011" border="0" /></a></p>
<p>Zebra_Dialog is a small (4KB minified), compact (one JS file, no dependencies other than jQuery 1.5.2+) and highly configurable dialog box plugin for jQuery, meant to replace JavaScript&#8217;s alert and confirmation dialog boxes and built using the jQuery Plugin Boilerplate.</p>
<h3>25. <a href="http://bryanlynn.com/double-vision/">Double Vision</a></h3>
<p><a href="http://bryanlynn.com/double-vision/"><img src="http://cdn1.1stwebdesigner.com/wp-content/uploads/2011/07/jquery-tools-2011/double-vision-new-cool-jquery-plugins-2011.jpg" alt="Double-vision-new-cool-jquery-plugins-2011" border="0" /></a></p>
<p>A jQuery 1.6.1 plugin used for moving text from input’s to textarea.</p>
<h3>26. <a href="http://editor.scienceco.de/">Textarea Code Editor</a></h3>
<p><a href="http://editor.scienceco.de/"><img src="http://cdn1.1stwebdesigner.com/wp-content/uploads/2011/07/jquery-tools-2011/code-editor-new-cool-jquery-plugins-2011.jpg" alt="Code-editor-new-cool-jquery-plugins-2011" border="0" /></a></p>
<p>This plugin transforms textareas into code editors with the following advantages: indentation with the Tab key, intelligent home key, auto indent on enter.</p>
<h3>27. <a href="http://cssglobe.com/post/9801/easy-paginate-jquery-plugin-for-pagination">Easy Paginate</a></h3>
<p><a href="http://cssglobe.com/post/9801/easy-paginate-jquery-plugin-for-pagination"><img src="http://cdn1.1stwebdesigner.com/wp-content/uploads/2011/07/jquery-tools-2011/easy-paginate-new-cool-jquery-plugins-2011.jpg" alt="Easy-paginate-new-cool-jquery-plugins-2011" border="0" /></a></p>
<p>This plugin allows you to browse easily through the list of items with pagination controls. It is very easy to implement and very lightweight so it might come in handy to use in your own projects.</p>
<h3>28. <a href="http://neteye.github.com/activity-indicator.html">Activity Indicator</a></h3>
<p><a href="http://neteye.github.com/activity-indicator.html"><img src="http://cdn1.1stwebdesigner.com/wp-content/uploads/2011/07/jquery-tools-2011/activity-indicator-new-cool-jquery-plugins-2011.jpg" alt="Activity-indicator-new-cool-jquery-plugins-2011" border="0" /></a></p>
<p>Activity Indicator is a resolution independent indicator that works in any browser.</p>
<h3>29. <a href="http://aquantum-demo.appspot.com/file-upload">jQuery File Upload</a></h3>
<p><a href="http://aquantum-demo.appspot.com/file-upload"><img src="http://cdn1.1stwebdesigner.com/wp-content/uploads/2011/07/jquery-tools-2011/file-upload-new-cool-jquery-plugins-2011.jpg" alt="File-upload-new-cool-jquery-plugins-2011" border="0" /></a></p>
<p>jQuery File Upload is a jQuery based lightweight file uploader with multiple file upload and drag&amp;drop support.</p>
<h3>30. <a href="http://www.bitstorm.org/jquery/color-animation/">Color Animation</a></h3>
<p><a href="http://www.bitstorm.org/jquery/color-animation/"><img src="http://cdn1.1stwebdesigner.com/wp-content/uploads/2011/07/jquery-tools-2011/color-animation-new-cool-jquery-plugins-2011.jpg" alt="Color-animation-new-cool-jquery-plugins-2011" border="0" /></a></p>
<p>With jQuery&#8217;s animate function, you can animate all kinds of css-properties. What&#8217;s really missing from jQuery is animating colors. This plugin will add this feature.</p>
<h3>30.1. <a href="http://codecanyon.net/item/fancy-music-player-v20-jquery-plugin/498071?ref=1stwebdesigner">Fancy Music Player V2.0</a></h3>
<p>Player works like this  - first it detects if Flash Player 9 or higher is installed. If yes a hidden flash movie(swf) will be used, that communicates via javascript with the HTML user interface. If no Flash Player is installed, the new HTML5 audio engine will be used, which is supported by all iToys(iPhone, iPad etc.).</p>
<p><a href="http://codecanyon.net/item/fancy-music-player-v20-jquery-plugin/498071?ref=1stwebdesigner"><img class="alignnone" title="Fancy Music Player" src="http://1.s3.envato.com/files/5687909/preview_big_fmp.jpg" alt="" width="590" height="300" /></a></p>
<p><a href="http://codecanyon.net/item/fancy-music-player-v20-jquery-plugin/full_screen_preview/498071?ref=1stwebdesigner">View Demo</a></p>
<h3>31. <a href="http://thecodemine.org/">jQuery Formwizard</a></h3>
<p><a href="http://thecodemine.org/"><img src="http://cdn1.1stwebdesigner.com/wp-content/uploads/2011/07/jquery-tools-2011/form-wizard-new-cool-jquery-plugins-2011.jpg" alt="Form-wizard-new-cool-jquery-plugins-2011" border="0" /></a></p>
<p>The form wizard plugin is a jQuery plugin which can be used to create wizard like page flows for forms without having to reload the page in between wizard steps.</p>
<h3>32. <a href="http://jquery.anantanandgupta.net/plugins/jQuerySpinnerControl/">jQuery Spinner Control</a></h3>
<p><a href="http://jquery.anantanandgupta.net/plugins/jQuerySpinnerControl/"><img src="http://cdn1.1stwebdesigner.com/wp-content/uploads/2011/07/jquery-tools-2011/spinner-control-new-cool-jquery-plugins-2011.jpg" alt="Spinner-control-new-cool-jquery-plugins-2011" border="0" /></a></p>
<p>Converts the text input to a spinner control. This plugin works fine with ASP.net for the post backs.</p>
<h3>33. <a href="http://ben.ferit.im/doc.html">jEscape</a></h3>
<p><a href="http://ben.ferit.im/doc.html"><img src="http://cdn1.1stwebdesigner.com/wp-content/uploads/2011/07/jquery-tools-2011/jescape-new-cool-jquery-plugins-2011.jpg" alt="Jescape-new-cool-jquery-plugins-2011" border="0" /></a></p>
<p>This extension captures all the keydown events faster and less time writing code, you&#8217;ll profit.</p>
<h3>34. j<a href="http://www.remylab.net46.net/demos/jquery-plugins/jpaginator/">Paginator</a></h3>
<p><a href="http://www.remylab.net46.net/demos/jquery-plugins/jpaginator/"><img src="http://cdn1.1stwebdesigner.com/wp-content/uploads/2011/07/jquery-tools-2011/paginator-new-cool-jquery-plugins-2011.jpg" alt="Paginator-new-cool-jquery-plugins-2011" border="0" /></a></p>
<p>A plugin for animated pagination, with auto-acceleration, a slider, and highly customizable.</p>
<h3>35. <a href="http://www.steamdev.com/snippet/">Snippet</a></h3>
<p><a href="http://www.steamdev.com/snippet/"><img src="http://cdn1.1stwebdesigner.com/wp-content/uploads/2011/07/jquery-tools-2011/snippet-new-cool-jquery-plugins-2011.jpg" alt="Snippet-new-cool-jquery-plugins-2011" border="0" /></a></p>
<p>Snippet is a jQuery syntax highlighting plugin built on top of the SHJS script found on SourceForge. Snippet provides a quick and easy way of highlighting source code passages in HTML documents.</p>
<h3>36. <a href="http://www.codebasehero.com/download/?file=music-player">HTML5 jQuery Music Player</a></h3>
<p><a href="http://www.codebasehero.com/download/?file=music-player"><img src="http://cdn1.1stwebdesigner.com/wp-content/uploads/2011/07/jquery-tools-2011/html5-music-player-new-cool-jquery-plugins-2011.jpg" alt="Html5-music-player-new-cool-jquery-plugins-2011" border="0" /></a></p>
<p>A HTML5 music player that uses an awesome design created by Orman Clark and jPlayer.</p>
<h3>37. <a href="http://www.sarpdoruktahmaz.com/projects/j-link-preview/">jQuery Link Preview</a></h3>
<p><a href="http://www.sarpdoruktahmaz.com/projects/j-link-preview/"><img src="http://cdn1.1stwebdesigner.com/wp-content/uploads/2011/07/jquery-tools-2011/link-preview-new-cool-jquery-plugins-2011.jpg" alt="Link-preview-new-cool-jquery-plugins-2011" border="0" /></a></p>
<p>jLinkPreview is a plug-in for jQuery Library which simply allows you to see a link&#8217;s preview image before you visit them by just hovering on it. Link preview will appear by your cursor when you hover.</p>
<h3>38. <a href="http://www.kfsoft.info/MyQRCode/demo.php">My QR Code </a></h3>
<p><a href="http://www.kfsoft.info/MyQRCode/demo.php"><img src="http://cdn1.1stwebdesigner.com/wp-content/uploads/2011/07/jquery-tools-2011/qr-code-new-cool-jquery-plugins-2011.jpg" alt="Qr-code-new-cool-jquery-plugins-2011" border="0" /></a></p>
<p>This plugin generate QR code for mobile devices using Google Chart API with jQuery. By default, the plugin will generate the QR code for the URL of the page. You can also specify the text, encoding and size of the QR code.</p>
<h3>39. <a href="http://www.geektantra.com/2011/05/jquery-tagbox-plugin/">jQuery TagBox</a></h3>
<p><a href="http://www.geektantra.com/2011/05/jquery-tagbox-plugin/"><img src="http://cdn1.1stwebdesigner.com/wp-content/uploads/2011/07/jquery-tools-2011/tagbox-new-cool-jquery-plugins-2011.jpg" alt="Tagbox-new-cool-jquery-plugins-2011" border="0" /></a></p>
<p>This is a jQuery plugin to help add tags like input in your forms.</p>
<h3>40. <a href="http://jackrugile.com/jrumble/">jRumble</a></h3>
<p><a href="http://jackrugile.com/jrumble/"><img src="http://cdn1.1stwebdesigner.com/wp-content/uploads/2011/07/jquery-tools-2011/rumble-new-cool-jquery-plugins-2011.jpg" alt="Rumble-new-cool-jquery-plugins-2011" border="0" /></a></p>
<p>jRumble is a jQuery plugin that rumbles, vibrates, shakes, and rotates any element you choose. It&#8217;s great to use as a hover effect or a way to direct attention to an element. You can control the X, Y, and rotation range, the speed, and event trigger for the rumble.</p>
<h3>41. <a href="http://playground.mobily.pl/jquery/mobily-map.html">MobilyMap</a></h3>
<p><a href="http://playground.mobily.pl/jquery/mobily-map.html"><img src="http://cdn1.1stwebdesigner.com/wp-content/uploads/2011/07/jquery-tools-2011/mobily-map-new-cool-jquery-plugins-2011.jpg" alt="Mobily-map-new-cool-jquery-plugins-2011" border="0" /></a></p>
<p>MobilyMap is a jQuery plugin (7KB) that can create a Google Maps-like, draggable interface from any image.</p>
<h3>42. <a href="http://tympanus.net/codrops/2011/06/09/grid-navigation-effects/">Grid Navigation</a></h3>
<p><a href="http://tympanus.net/codrops/2011/06/09/grid-navigation-effects/"><img src="http://cdn1.1stwebdesigner.com/wp-content/uploads/2011/07/jquery-tools-2011/grid-navigation-new-cool-jquery-plugins-2011.jpg" alt="Grid-navigation-new-cool-jquery-plugins-2011" border="0" /></a></p>
<p>jQuery plugin for achieving some neat grid navigation effects.</p>
<h3>43. <a href="http://moreco.de/simple-overlay/">Simple Overlay</a></h3>
<p><a href="http://moreco.de/simple-overlay/"><img src="http://cdn1.1stwebdesigner.com/wp-content/uploads/2011/07/jquery-tools-2011/overlay-new-cool-jquery-plugins-2011.jpg" alt="Overlay-new-cool-jquery-plugins-2011" border="0" /></a></p>
<p>A jQuery Plugin for easily adding lightweight, flexible overlays to your projects.</p>
<h3>44. <a href="http://jonobr1.github.com/diagonalFade/">diagonalFade</a></h3>
<p><a href="http://jonobr1.github.com/diagonalFade/"><img src="http://cdn1.1stwebdesigner.com/wp-content/uploads/2011/07/jquery-tools-2011/diagonal-fade-new-cool-jquery-plugins-2011.jpg" alt="Diagonal-fade-new-cool-jquery-plugins-2011" border="0" /></a></p>
<p>diagonalFade is a jQuery plugin allowing you to easily specify direction, fade-in, fade-out, and a host of other options to a grouping of elements. All you have to do is import it, specify the container to which the group of items resides, and poof, you&#8217;re off and away.</p>
<h3>45. <a href="http://www.egrappler.com/jquery-spin-button-plugin-smart-spin/">Smart Spin</a></h3>
<p><a href="http://www.egrappler.com/jquery-spin-button-plugin-smart-spin/"><img src="http://cdn1.1stwebdesigner.com/wp-content/uploads/2011/07/jquery-tools-2011/smart-spin-new-cool-jquery-plugins-2011.jpg" alt="Smart-spin-new-cool-jquery-plugins-2011" border="0" /></a></p>
<p>Smart spin is a jQuery spin button plugin that mimics the very common windows spin button control. Smart spin allows you to select a value between minimum and maximum values using either mouse or keyboard. You can also enter a value via keyboard.</p>
<h3>46. <a href="http://www.egrappler.com/jquery-credit-card-validation-plugin-smart-validate/">jQuery Credit Card Validation</a></h3>
<p><a href="http://www.egrappler.com/jquery-credit-card-validation-plugin-smart-validate/"><img src="http://cdn1.1stwebdesigner.com/wp-content/uploads/2011/07/jquery-tools-2011/credit-card-new-cool-jquery-plugins-2011.jpg" alt="Credit-card-new-cool-jquery-plugins-2011" border="0" /></a></p>
<p>Smart Validate is a jQuery credit card validation plugin, that makes credit card format validation a simple task. It ensures that user has entered valid credit card number before making actual transaction.</p>
<h3>47. <a href="http://www.digicrafts.com.hk/components/JSAJAXPayPalCart">Ajax PayPal Cart</a></h3>
<p><a href="http://www.digicrafts.com.hk/components/JSAJAXPayPalCart"><img src="http://cdn1.1stwebdesigner.com/wp-content/uploads/2011/07/jquery-tools-2011/ajax-paypal-new-cool-jquery-plugins-2011.jpg" alt="Ajax-paypal-new-cool-jquery-plugins-2011" border="0" /></a></p>
<p>AJAX PayPal Cart is a easy to use JQuery plugin for web developer to add a full function shopping cart in their website. The AJAX cart can included a cart widget which allow display of cart information easily. Support PayPal Website Payment Standard.</p>
<h3>48. <a href="http://www.m2az.com/folderPreview/">jQuery.folderPreview</a></h3>
<p><a href="http://www.m2az.com/folderPreview/"><img src="http://cdn1.1stwebdesigner.com/wp-content/uploads/2011/07/jquery-tools-2011/folder-preview-new-cool-jquery-plugins-2011.jpg" alt="Folder-preview-new-cool-jquery-plugins-2011" border="0" /></a></p>
<p>jQuery.folderPreview is a jQuery plugin that takes a series of images and positions them so that they appear within a folder graphic. This enhances the attractiveness of a browsing UI system, allowing the user to visualize the contents of the folder.</p>
<h3>49. <a href="https://github.com/christianv/jquery-lifestream">jQuery Lifestream</a></h3>
<p><a href="https://github.com/christianv/jquery-lifestream"><img src="http://cdn1.1stwebdesigner.com/wp-content/uploads/2011/07/jquery-tools-2011/lifestream-new-cool-jquery-plugins-2011.jpg" alt="Lifestream-new-cool-jquery-plugins-2011" border="0" /></a></p>
<p>Show a stream of your online activity with jQuery</p>
<h3>50. <a href="http://sandbox.sebnitu.com/jquery/quovolver/">QuoVolver</a></h3>
<p><a href="http://sandbox.sebnitu.com/jquery/quovolver/"><img src="http://cdn1.1stwebdesigner.com/wp-content/uploads/2011/07/jquery-tools-2011/quovolver-new-cool-jquery-plugins-2011.jpg" alt="Quovolver-new-cool-jquery-plugins-2011" border="0" /></a></p>
<p>Quovolver is a simple extension for jQuery that takes a group of quotes and displays them on your page in an elegant way.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.1stwebdesigner.com/css/jquery-plugins-2011/feed/</wfw:commentRss>
		<slash:comments>37</slash:comments>
		</item>
		<item>
		<title>WordPress Plugin Development &#8211; Relate Posts as a Series Part 2</title>
		<link>http://www.1stwebdesigner.com/css/wordpress-plugin-relate-posts-as-series-2/</link>
		<comments>http://www.1stwebdesigner.com/css/wordpress-plugin-relate-posts-as-series-2/#comments</comments>
		<pubDate>Tue, 05 Jul 2011 10:00:50 +0000</pubDate>
		<dc:creator>Rochester Oliveira</dc:creator>
				<category><![CDATA[Coding]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Plugins]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[WordPress]]></category>
		<category><![CDATA[plugin]]></category>
		<category><![CDATA[plugin development]]></category>
		<category><![CDATA[tutorial]]></category>

		<guid isPermaLink="false">http://www.1stwebdesigner.com/?p=45948</guid>
		<description><![CDATA[So, we started our dive into WordPress plugin development with the first part of this tutorial where we talked a little about planning, basic plugin structure, custom post types, metaboxes and how to add custom functions to WordPress&#8217;s defaults actions. Today we will talk a little more about metaboxes and jQuery, shortcodes, and front-end functionality. [...]]]></description>
			<content:encoded><![CDATA[<p>So, we started our dive into WordPress plugin development with the <a href="http://www.1stwebdesigner.com/css/wordpress-plugin-development-relate-posts-part-1/">first part of this tutorial</a> where we talked a little about planning, basic plugin structure, custom post types, metaboxes and how to add custom functions to WordPress&#8217;s defaults actions.</p>
<p>Today we will talk a little more about metaboxes and jQuery, shortcodes, and front-end functionality.</p>
<p>All these things with a pretty practical example of how to make a plugin that will relate posts as a series.</p>
<p>So, let&#8217;s rock!</p>
<p><span id="more-45948"></span></p>
<h2>A little recap&#8230; and download!</h2>
<p>Last time we completed the first three steps:</p>
<ol>
<li>Planning &#8211; We&#8217;ve made our entity-relationship diagram to know which data we would have to store</li>
<li>Create our plugin and custom post type &#8211; We&#8217;ve created the basic file for our plugin, and registered our series custom post type</li>
<li>Post functionality &#8211; We&#8217;ve made some metaboxes to store custom data, and added them to WordPress&#8217;s default post saving function via actions.</li>
</ol>
<p>If you didn&#8217;t read the first part of this tutorial, I highly recommend you to do this now, but if you don&#8217;t want to, you can still understand the functions and logic we are using here and make use of it.</p>
<p>Well, for people who are in a hurry, you can <a href="http://cdn1.1stwebdesigner.com/wp-content/uploads/2011/07/1WDSeries.zip">download the fully working plugin</a> and make use of it without having to copy/paste all this code ;).</p>
<h2>Step 4 &#8211; Series functionality</h2>
<h3>Registering our metabox</h3>
<p>After we have control over all our posts related to series, we need to be able to manually edit the series itself.</p>
<p>In order to do this, we will need some metaboxes on them also. So, let&#8217;s edit our plugin with this code (here is just the additional code to avoid any confusion with the code that I explained last time, and won&#8217;t explain now):</p>
<pre class="brush: php; title: ; notranslate">&lt;?php&lt;br /--&gt;//this function will register our metabox for wd_series custom post type
	function wd_call_meta() {
		add_meta_box(
			'series-data', // id of the &lt;div&gt; we'll add
			'Series Custom Data', //title
			'wd_series_options', // callback function that will echo the box content
			'wd_series', // where to add the box: on &quot;post&quot;, &quot;page&quot;, or &quot;link&quot; page
			'side', //positioning
			'low' //positioning
		);
	}
//with this we call it!
add_action('admin_menu', 'wd_call_meta');
?&gt;</pre>
<h3>Our HTML metabox and jQuery enhancements</h3>
<p>So, as you can see this function doesn&#8217;t have the metabox itself, it just says <em>&#8220;Hey, WordPress, you should add function wd_series_options as a metabox for this guy!&#8221;</em>. So we now need the metabox itself.</p>
<p>This is a tricky part since this box will give the user the ability to add &#8220;fake&#8221; posts to the series, so our readers could be interested in this series content. So what do we have now is:</p>
<ul>
<li>Standard posts for a series, added via post editing screen</li>
<li>Fake posts for a series, added via series editing screen</li>
<li>Delete option, to remove a post from a series</li>
</ul>
<p>We have also the opening / closing option for a series, and a really important attribute, the size of the series, so we don&#8217;t get lost in all our counters.</p>
<p>To get this working we will need some jQuery. We will have a &#8220;model&#8221; row, and when the user wants to add more lines we will get this model and duplicate it inside our form. We have to pay attention in regards to recovering data. We have to dynamically add rows as they are needed by one series. And we have, of course, some CSS for that.</p>
<p>Let&#8217;s do it this way:</p>
<pre class="brush: php; title: ; notranslate">&lt;?php

function wd_series_options() {
		global $post;
		//get saved data
		$custom    = get_post_custom($post-&gt;ID);
		$open      = $custom[&quot;open&quot;][0];
		$numFields = $custom[&quot;size&quot;][0];

		$openNo = $openYes = &quot;&quot;;
		if ($open == &quot;yes&quot;) {
			$openYes = &quot;checked = 'checked'&quot;;
		} else {
			$openNo = &quot;checked = 'checked'&quot;;
		}

		$series_items = array();
		$i = 0;
		while($i &lt; $numFields) {
			$i++;
			$key = &quot;name_&quot;.$i;
			$series_items[$i] = $custom[$key][0];
		}
		$numFields++;
?&gt;

&lt;table&gt;
&lt;tbody&gt;
&lt;tr class=&quot;space&quot;&gt;
&lt;td&gt;&lt;label&gt;Open?&lt;/label&gt;&lt;/td&gt;
&lt;td&gt;
				&lt;label&gt;&lt;input id=&quot;wd_open&quot; name=&quot;wd_open&quot; type=&quot;radio&quot; value=&quot;yes&quot; /&gt; /&gt; Yes, it is open.&lt;/label&gt;

				&lt;label&gt;&lt;input id=&quot;wd_open&quot; name=&quot;wd_open&quot; type=&quot;radio&quot; value=&quot;no&quot; /&gt; /&gt; No, it is closed&lt;/label&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
	&lt;table class=&quot;default-line&quot;&gt;
		&lt;tr&gt;
			&lt;td&gt;&lt;input id=&quot;order_K&quot; name=&quot;order_K&quot; type=&quot;text&quot; value=&quot;&quot; size=&quot;5&quot; /&gt;&lt;/td&gt;
			&lt;td&gt;&lt;input id=&quot;name_K&quot; name=&quot;name_K&quot; type=&quot;text&quot; value=&quot;&quot; /&gt;&lt;/td&gt;
			&lt;td class=&quot;check&quot;&gt;&lt;input id=&quot;remove_K&quot; name=&quot;remove_K&quot; type=&quot;checkbox&quot; value=&quot;remove&quot; /&gt;&lt;/td&gt;
		&lt;/tr&gt;
	&lt;/table&gt;
	&lt;input type=&quot;hidden&quot; id=&quot;NumFields&quot; name=&quot;NumFields&quot; value=&quot;&lt;?php echo $numFields; ?&gt;&quot; /&gt;
	&lt;table&gt;
		&lt;tr&gt;
			&lt;td&gt;Order&lt;/td&gt;
			&lt;td&gt;PostName&lt;/td&gt;
			&lt;td class=&quot;checkboxTd&quot;&gt;Remove?&lt;/td&gt;
		&lt;/tr&gt;
	&lt;/table&gt;
	&lt;div class=&quot;ins&quot;&gt;
	&lt;?php
		foreach($series_items as $key =&gt; $name) {
			echo &quot;&lt;table&gt;&quot;;
				echo &quot;&lt;tr&gt;&quot;;
					echo &quot;&lt;td&gt;&lt;input id='order_$key' name='order_$key' type='text' value='$key' size='5' /&gt;&lt;/td&gt;&quot;;
					echo &quot;&lt;td&gt;&lt;input id='name_$key' name='name_$key' type='text' value='$name' /&gt;&lt;/td&gt;&quot;;
					echo &quot;&lt;td class='check'&gt;&lt;input id='remove_$key' name='remove_$key' type='checkbox' value='remove' /&gt;&lt;/td&gt;&quot;;
				echo &quot;&lt;/tr&gt;&quot;;
			echo &quot;&lt;/table&gt;&quot;;
		}
	?&gt;
	&lt;/div&gt;
	&lt;table&gt;
		&lt;tr id=&quot;addItem&quot;&gt;
&lt;td colspan=&quot;3&quot;&gt;&lt;a id=&quot;clickLink&quot; class=&quot;link&quot; onclick=&quot;addLine();&quot;&gt;Add new line&lt;/a&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;style type=&quot;text/css&quot;&gt;
	.default-line {
		display: none;
	}
	#series-data table {
		width: 100%
	}
		#series-data tr.space td {
			padding-bottom: 10px;
		}
			#series-data .space label {
				padding-right: 20px
			}
		#series-data .check {
			text-align: center;
		}
		#addItem td {
			padding-top: 10px;
			text-align: right;
		}
	.checkboxTd {
		width: 20px;
	}
	.link { cursor: pointer; }
&lt;/style&gt;
&lt;script type=&quot;text/javascript&quot;&gt;
	function addLine() {
		jQuery(&quot;.default-line&quot;).clone().appendTo(&quot;.ins&quot;);
		var numElem = jQuery(&quot;#NumFields&quot;).attr('value');
		jQuery(&quot;.ins .default-line&quot;).fadeIn().removeClass('default-line');
		correctsLine(numElem);
	}
	function correctsLine(nID) {
		//goes switching K to correct number of line
		fieldName  = &quot;order_&quot; + nID;
		jQuery(&quot;.ins input#order_K&quot;).attr('value', ( parseInt(nID)+1) ).attr('id', fieldName).attr('name', fieldName);

		fieldName  = &quot;name_&quot; + nID;
		jQuery(&quot;.ins input#name_K&quot;).attr('id', fieldName).attr('name', fieldName);

		fieldName  = &quot;remove_&quot; + nID;
		jQuery(&quot;.ins input#remove_K&quot;).attr('id', fieldName).attr('name', fieldName);

		//corrects number of fields
		nID++;
		jQuery(&quot;#NumFields&quot;).attr('value', nID);
	}
	jQuery(window).load(function(){
		addLine(); //adds first (blank) row
	});
&lt;/script&gt;
</pre>
<p>With this code you should see something like this as your series metabox:</p>
<p><img class="alignnone size-full wp-image-49435" title="box" src="http://cdn1.1stwebdesigner.com/wp-content/uploads/2011/06/box.jpg" alt="" width="548" height="512" /></p>
<h3>Edit our default post saving function</h3>
<p>And when you click on &#8220;Add new line&#8221;, believe me, it should create a fresh and brilliant new line.</p>
<p>Now we have this pretty box, but when you click &#8220;Update&#8221; nothing happens. This is why we haven&#8217;t prepared our WordPress insert post function to treat this data. What we have to do now it to say to WordPress <em>&#8220;Hey, when you see this field in wd_series post type, delete all old data and save this new one for me, ok?&#8221;</em>.</p>
<p>One important thing to note here is that we must delete all  previous data and use some logic to reorder the series when needed.</p>
<p>Our magic here relies on ksort php function, so we save a temporary array and save all the items in the correct order after run this function.</p>
<p>Well, let&#8217;s do it:</p>
<pre class="brush: php; title: ; notranslate">&lt;?php //we need a function that recieves post_id and $_POST data
function wd_meta($post_id, $post = null) {
//gets our POST custom data and saves it as meta keys, when needed
/* we have to save this metafields: open = Yes / No for open / closed series
size = how many items do we have in this series, so we can adjust our order counter
name_ORDER = the name of the ORDER'th item
post_ORDER = ID of the ORDER'th item
order_POST = Order of the ID (post) */
if( $post-&gt;post_type == &quot;wd_series&quot;  ) {
			//update series state (open / closed)
			$open = @$_POST[&quot;wd_open&quot;];
			update_post_meta( $post_id, &quot;open&quot;, $open );

			$size = @$_POST[&quot;NumFields&quot;];
			$i = 0;

			$organize = array();
			while ($i &lt; $size) {
				//let's pre-organize all posts
				$survive = $key = $remove = $order = $name = $post = null;

				$key = &quot;remove_&quot;.$i;
				$remove = @$_POST[$key];

				if (empty($remove)) {
					//we won't delete this guy, and we'll put he in his right order
					$key = &quot;order_&quot;.$i;
					$order = @$_POST[$key];

					$key = &quot;name_&quot;.$i;
					$name = @$_POST[$key];

					$key = &quot;post_&quot;.$i;
					$post = get_post_meta($post_id, $key, true);

					if (!empty($name)) {
						$organize[$order] = array( 'name' =&gt; $name, 'post' =&gt; $post);
						$survive = true;
					}
				}
				//we will pre delete everybody, to prevent trash in here
				$key = &quot;name_&quot;.$i;
				delete_post_meta($post_id, $key);

				$key = &quot;post_&quot;.$i;
				$post = get_post_meta($post_id, $key, true);
				delete_post_meta($post_id, $key);

				$key = &quot;order_&quot;.$post;
				delete_post_meta($post_id, $key);

				//if it won't survive, we delete series_id from post_id
				if(!$survive) {
					$key = &quot;series_id&quot;;
					delete_post_meta($post, $key);
				}
				$i++;
			}
			//let's correctly order this
			ksort($organize);
			$i = 0;
			foreach($organize as $item) {
				$i++;

				$key = &quot;name&quot;;
				$nam = $item[$key];
				$key = &quot;name_&quot;.$i;
				update_post_meta( $post_id, $key, $nam );

				$key  = &quot;post&quot;;
				$post = $item[$key];
				if(!empty($post)) {
					$key = &quot;post_&quot;.$i;
					update_post_meta( $post_id, $key, $post );
					$key = &quot;order_&quot;.$post;
					update_post_meta( $post_id, $key, $i );
				}
			}

			$size = count($organize);
			update_post_meta( $post_id, &quot;size&quot;, $size );
		}
	}
	//it's me saying to wordpress &quot;Hey guy, don't forget to save this data when you insert or update posts!&quot;
	add_action(&quot;wp_insert_post&quot;, 'wd_meta', 10, 2);
?&gt;</pre>
<p>Now we have our plugin working, let&#8217;s improve it.</p>
<h2>Step 5 &#8211; Shortcodes and theming functions</h2>
<p>Before we can output our posts we have to prepare two kind functions:</p>
<ul>
<li>Common theming functions &#8211; Something like wd_series($args), so we can use for theming and widgets</li>
<li>Shortcodes &#8211; Something like [wd-series] so we can insert it directly from content edit mode.</li>
</ul>
<h3>Common functions</h3>
<p>We will need to run a get_post loop, because probably our series will be shown inside another WordPress loop, so we can&#8217;t use WordPress&#8217; default loop. Think about it this way: we will show a series when we are INSIDE a post, right? Thus the best way is via get_post.</p>
<p>Then we will just prepare a simple output function based on current post&#8217;s ID so it will show all items for the series related to it.</p>
<p>As we store the series related to this post inside &#8220;series_id&#8221; custom field, we just need to run a get_post for this series_id and output all metadata about series items.</p>
<p>Since for every item the output function is potentially the same, we will create two functions this time, one for items output and other for complete series output, as follow:</p>
<pre class="brush: php; title: ; notranslate">&lt;?php //display item with or without link
function wd_item( $name, $postItem ) {
	if ( ! empty ( $postItem ) ) {
		$link = get_permalink($postItem);
		echo &quot;&lt;a title=&quot;$name&quot; href=&quot;$link&quot;&gt;$name&lt;/a&gt;&quot;;
	} else {
		echo $name;
	}
}
//output!
function wd_series ($series) {
	$title = get_the_title($series);
	$meta  = get_post_custom($series);

	echo &quot;&lt;h3&gt;$title&lt;/h3&gt;&quot;;
	$size = $meta[&quot;size&quot;][0];
	$i = 1;
	echo &quot;&lt;ol&gt;&quot;;
	while ($i &lt;= $size) {
		$key = &quot;name_&quot;.$i;
		$name = $meta[$key][0];

		$key = &quot;post_&quot;.$i;
		$post_item = $meta[$key][0];

		echo &quot;&lt;li&gt;&quot;;
			wd_item( $name, $post_item);
		echo &quot;&lt;/li&gt;&quot;;

		$i++;

		$name = $post_item = null;
	}
	echo &quot;&lt;/ol&gt;&quot;;
}
?&gt;</pre>
<h3>Shortcodes</h3>
<p>So with the function above we can output our series in our template, and it is pretty customizable as you can see. But what if you want to give your writers the ability to decide where the series content should appear? Well, to do this you will need a shortcode.</p>
<p>Long story short, they give the ability to call functions via post content. So while I&#8217;m writing this post I could write [wd-series] and BAM! our series content would have to appear just above this text.</p>
<p>It is pretty easy to register a shortcode, and as long as we have our output function defined it will be even easier. With no more than six lines you can do it:</p>
<pre class="brush: php; title: ; notranslate">&lt;?php // [wd-series]
function wd_series_shortcode() {
              global $post;
              $series = get_post_meta($post---&gt;ID, &quot;series_id&quot;, true);

              wd_series($series);
}
add_shortcode( 'wd-series', 'wd_series_shortcode' );
?&gt;</pre>
<p>After all this code, you will see something similar to this when you write [wd-series] in your content box:</p>
<p><img class="alignnone size-full wp-image-49511" title="output" src="http://cdn1.1stwebdesigner.com/wp-content/uploads/2011/06/output.jpg" alt="" width="581" height="384" /></p>
<h2>Are you hungry yet?</h2>
<p>This code surely could be improved and I know that some of our  brilliant readers could point out some things to make it better. So why not leave a comment and share your thoughts?</p>
<p>And finally, I recommend you dig a little deeper into the  <a href="http://codex.wordpress.org/Shortcode_API">Shortcodes API</a>, since it is a great tool when well used!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.1stwebdesigner.com/css/wordpress-plugin-relate-posts-as-series-2/feed/</wfw:commentRss>
		<slash:comments>20</slash:comments>
		</item>
		<item>
		<title>CSS Tricks for Smart Quotes and Tooltips</title>
		<link>http://www.1stwebdesigner.com/css/css-tricks-quotes-tooltips/</link>
		<comments>http://www.1stwebdesigner.com/css/css-tricks-quotes-tooltips/#comments</comments>
		<pubDate>Fri, 01 Jul 2011 10:00:31 +0000</pubDate>
		<dc:creator>Rochester Oliveira</dc:creator>
				<category><![CDATA[Coding]]></category>
		<category><![CDATA[HTML & CSS]]></category>
		<category><![CDATA[coding]]></category>
		<category><![CDATA[css tricks]]></category>
		<category><![CDATA[quotes]]></category>
		<category><![CDATA[smart quotes]]></category>
		<category><![CDATA[tips]]></category>
		<category><![CDATA[tooltip]]></category>
		<category><![CDATA[tutorial]]></category>

		<guid isPermaLink="false">http://www.1stwebdesigner.com/?p=48643</guid>
		<description><![CDATA[The CSS content property is a powerful way to add content to some elements via CSS. It is good because it allows you to add &#8220;formatting content&#8221;, that is things that you need in your presentation but isn&#8217;t the content itself, like quotes, icons (when you have text along with them), titles (not the text [...]]]></description>
			<content:encoded><![CDATA[<p>The CSS content property is a powerful way to add content to some elements via CSS. It is good because it allows you to add &#8220;formatting content&#8221;, that is things that you need in your presentation but isn&#8217;t the content itself, like quotes, icons (when you have text along with them), titles (not the text title, the HTML attribute).</p>
<p>But you may thinking now &#8220;Well, isn&#8217;t content always HTML&#8217;s job?&#8221; Well, most of the time it is.</p>
<p>Think about it a little bit: when you have a fancy quote, image caption, or even a custom icon for certain links (like &#8220;.pdf&#8221;), aren&#8217;t all these things just &#8220;decoration&#8221;? They are just there to clarify the message of your content, they are meaningless by themselves.</p>
<p>So we will learn simple and cleaner techniques to get some cool results via CSS! Although our title only mentioned smart quotes, we will do show you some other quick examples to get the most of this cool CSS trick.</p>
<p>So, let&#8217;s rock.</p>
<p><span id="more-48643"></span></p>
<h2>Our final result</h2>
<p>Yeah, let&#8217;s start with a preview. <a href="http://cdn1.1stwebdesigner.com/wp-content/uploads/2011/06/css-before-after-content-tricks/css-before-after-content-tricks/index.html" target="_blank">Take a look at this demo</a>, or <a href="http://cdn1.1stwebdesigner.com/wp-content/uploads/2011/06/css-before-after-content-tricks/css-before-after-content-tricks.zip" target="_blank">download it</a> and  switch off the CSS. You will see that the formatting is completely separated  from content.</p>
<p><img class="alignnone size-full wp-image-48970" title="demo" src="http://cdn1.1stwebdesigner.com/wp-content/uploads/2011/06/demo.jpg" alt="" width="550" height="400" /></p>
<h2>Smart quotes &#8211; the smart way</h2>
<p><a href="http://www.1stwebdesigner.com/design/web-typography-guide/">Typography</a> <a href="http://www.1stwebdesigner.com/css/css3-text-effects-typography/">is a really</a> <a href="http://www.1stwebdesigner.com/inspiration/the-secret-of-successful-minimal-font-usage/">important part</a> of websites. So are the small typographic details.</p>
<p>First of all, quotes that don&#8217;t have opening and closing quotes aren&#8217;t “smart”: &#8220;This example isn&#8217;t smart&#8221; &#8211; Smart quotes have a clear opening and ending style “Hi, I’m a smart quote”.</p>
<p>This is why smart quotes are much better than &#8220;dumb&#8221; quotes. I usually use dumb quotes, they are just OK for common text (just OK, if you have option, choose smart ones), but they are really bad in block quotes or citations.</p>
<p>Many people use images to get a better result, you know with that big and fancy curly quote. But let me tell you a secret: They are doing it wrong.</p>
<p>We have two really good pseudo-elements that will help us from now on, :before and :after. They basically give you the ability to add extra content before and after each element on the page. Pretty cool, isn&#8217;t it?</p>
<p>So instead of filling our code with unnecessary spans and other unwanted tags, we just write our common markup and adjust anything else with CSS.</p>
<p>In our demo, we have this basic markup:</p>
<pre class="brush: xml; title: ; notranslate">
&lt;blockquote&gt;
	&lt;p&gt;Lorem ipsum dolor sit amet, consectetur adipiscing elit. Maecenas metus est, egestas vel aliquet at, pellentesque nec lorem. Pellentesque molestie bibendum eros, eu suscipit nisi volutpat fringilla.&lt;/p&gt;
	&lt;p class=&quot;cite&quot;&gt;&lt;cite&gt;by Albert Einstein&lt;/cite&gt;&lt;/p&gt;
&lt;/blockquote&gt;
</pre>
<p>Nothing really new here, an ordinary block quote. So let&#8217;s make it prettier with our magic :before and pretty CSS:</p>
<pre class="brush: css; title: ; notranslate">
blockquote {
	padding-top: 20px;
	overflow: hidden; /* clearfix alternative */
	font-size: 18px;
	line-height: 150%;
	color: #454545;
}
blockquote:before {
	display: block;
	float: left;
	margin: 10px 15px 0 0;
	font-size: 100px; /* let's make it a big quote! */
	content: open-quote; /* here we define our :before as a smart quote. It could be any content, even the HTML entity alternative to this opening quote, that is “ */
	color: #bababa;
	text-shadow: 0 1px 1px #909090;
}
blockquote:after {
	content: none;
	/* could be content:close-quote; but lets keep it clean*/
}
</pre>
<p>As you can see, with a few lines you make all the magic. No images, no hidden secret.</p>
<p>The only downside (as almost anything with CSS) is the cross browser support. Any modern browser supports this feature, but IE8 (really, not a browser) only supports it when you have a doctype declaration.</p>
<h2>CSS pure tooltip</h2>
<p>Another really good use of it is to combine :after or :before with other pseudo-elements, like :hover. Yeah, I know you are wondering if we could have a pure CSS tooltip, and yes, we can.</p>
<p>What you have to do is just set a good title for your links, and see the magic happen with this snippet:</p>
<pre class="brush: css; title: ; notranslate">
a:hover:after {
	position: absolute;
	padding: 5px 10px;
	margin: -25px 0 0 -10px;
	font-size: 12px;
	content: attr(title);
	color: #333333;
	text-shadow: 0 1px 1px #909090;
	background: #ffffff;
	border: 1px solid #ffdada;
}
</pre>
<p>So you can customize it as you want :D</p>
<h2>Automatic icons for file-type links</h2>
<p>Sometimes we have to link other file types that the user can&#8217;t view in their browser. So when you link to anything other than HTML, it is always a good practice let the user know about it, with a simple icon, for example.</p>
<p>For this task you could use the $ attribute comparator. It searches for something at the end of an attribute, so if you have a[href$=".pdf"] it will apply the rules to any link that has an href attribute that ends with &#8220;.pdf&#8221;. Wow, it is exactly how a link to a pdf file should look!</p>
<p>But, we still need the :before to create a new &#8220;element&#8221; so we don&#8217;t mess up any other common links rules. So, our CSS this time will be:</p>
<pre class="brush: css; title: ; notranslate">
a[href$=&quot;.pdf&quot;]:before {
	padding: 5px 15px;
	margin: 0 5px 0 10px;
	content: &quot;&quot;;
	background: url(pdficon.png) no-repeat;
}
</pre>
<h2>Icons for external site links</h2>
<p>Sometimes we link to others sites resources, but we can get our visitors lost in the process, since they almost always don&#8217;t expect to be redirected to another site.</p>
<p>So it would be good to put a simple icon in our external links, so the user knows they&#8217;ll be redirected to another site.</p>
<p>This is a pretty tricky selector. We have the &#8220;begins with&#8221; selector, via a[href^="#othersite"] . Also we have the &#8220;not&#8221; selector, so you don&#8217;t need to select each site as external, but the support for this is still bad, so I wouldn&#8217;t recommend you use it. What you have to do then is to set all your links as &#8220;external&#8221; (with the icon) and just our sites links we set without the icon.</p>
<p>The CSS should be something like this:</p>
<pre class="brush: css; title: ; notranslate">
a:after {
	padding: 5px 15px;
	margin: 0 10px 0 5px;
	content: &quot;&quot;;
	background: url(external.png) no-repeat;
}
a[href^=&quot;#mysite&quot;]:after {
	/* let's reset defined stuff */
	padding: 0;
	margin: 0;
	content: none;
	background: none no-repeat;
}
</pre>
<h2>Image captions</h2>
<p>I swear to you, I&#8217;ve tried this one, and there is no way to have it working on all major browsers that I know of.</p>
<p>It seems to be a bug that when you set a valid src attribute you can&#8217;t use the content property (it is set to null in order to have the external content) so you can&#8217;t have a :before or :after declaration, since they need content as a non-null value.</p>
<p>But I hope we will see this working soon with all the browser updates happening.</p>
<h2>Are you hungry yet?</h2>
<p>I surely missed some cool uses for :before and :after. What do you think about it? Can you think of other uses for this? Why don&#8217;t you comment and share your thoughts?</p>
]]></content:encoded>
			<wfw:commentRss>http://www.1stwebdesigner.com/css/css-tricks-quotes-tooltips/feed/</wfw:commentRss>
		<slash:comments>10</slash:comments>
		</item>
		<item>
		<title>CSS Counters &#8211; The Right Way to Organize Your Ordered Content</title>
		<link>http://www.1stwebdesigner.com/css/css-counters-organize-ordered-content/</link>
		<comments>http://www.1stwebdesigner.com/css/css-counters-organize-ordered-content/#comments</comments>
		<pubDate>Tue, 28 Jun 2011 10:00:14 +0000</pubDate>
		<dc:creator>Rochester Oliveira</dc:creator>
				<category><![CDATA[Coding]]></category>
		<category><![CDATA[HTML & CSS]]></category>
		<category><![CDATA[coding]]></category>
		<category><![CDATA[counter]]></category>
		<category><![CDATA[html]]></category>
		<category><![CDATA[ordered list]]></category>
		<category><![CDATA[tutorial]]></category>

		<guid isPermaLink="false">http://www.1stwebdesigner.com/?p=49445</guid>
		<description><![CDATA[It is pretty common to see step-based content. Tutorials, shopping carts, FAQ&#8217;s, grandma&#8217;s recipes. You know, numbers and steps are really good to grab attention, so many writers use this. But, talking about HTML how should we write it? Most (all?) use numbers as text in headings, as they were common content. Well, let me [...]]]></description>
			<content:encoded><![CDATA[<p>It is pretty common to see step-based content. Tutorials, shopping carts, FAQ&#8217;s, grandma&#8217;s recipes. You know, numbers and steps are really good to grab attention, so many writers use this.</p>
<p>But, talking about HTML how should we write it? Most (all?) use numbers as text in headings, as they were common content.</p>
<p>Well, let me tell you a secret: They are doing it wrong.</p>
<p>Actually <a href="http://www.1stwebdesigner.com/design/how-to-improve-web-designer/">we are doing it wrong</a> ( nothing against this fantastic post of Ruben, just take a look at how we do the numbers, directly in HTML as text ).</p>
<p>A little time ago I was wondering about this thing, isn&#8217;t it more a CSS job? Actually yeah, it is. We have to keep content in HTML and presentation in CSS, and since we may want other ways to order titles, they are all about presentation. But, how can we do this kind of thing? One class for each item? That would be terrible!</p>
<p>Then CSS counter property comes to save us. It is a pretty unknown property that allows us to perform a simple count via CSS. It will be better explained with our demos :D</p>
<p>So, let&#8217;s rock!</p>
<p><img title="More..." src="http://cdn1.1stwebdesigner.com/wp-includes/js/tinymce/plugins/wordpress/img/trans.gif" alt="" /><span id="more-49445"></span></p>
<h2>Demo!</h2>
<p>Take a look at what you will do at the end of this tutorial:</p>
<p><img title="counter" src="http://cdn1.1stwebdesigner.com/wp-content/uploads/2011/06/counter.jpg" alt="" width="550" height="350" /><br />
I think you should <a href="http://cdn1.1stwebdesigner.com/wp-content/uploads/2011/06/css-counter/index.html" target="_blank">check out the demo</a>, and <a href="http://cdn1.1stwebdesigner.com/wp-content/uploads/2011/06/css-counter/css-counter.zip" target="_blank">download it</a> to try out a little bit more!</p>
<h2>So, counter?</h2>
<p>Basically a counter is a &#8220;variable&#8221; that we can create with CSS but the only two possible operations that we can perform with it is to increase or to reset. For such operations we can use counter-reset or counter-increment CSS properties.</p>
<p>A basic usage is the first case mentioned in this post, the organized content. So let&#8217;s say you have a multi-step tutorial and want it organized automatically, what you have to do is just add this to your CSS:</p>
<pre class="brush: css; title: ; notranslate">
body {
  counter-reset: first; /* our h1's counter is zero every time we have a body tag (hope only once) */
}
h1 {
  counter-increment: first; /* so, when we have one h1, our counter will increase one unit */
  counter-reset: second; /* and we will reset our h2's counter */
}
h1:before { /* wow, here we will append a pretty formated Step N - Item */
  content: &amp;quot;Step &amp;quot; counter(first) &amp;quot; - &amp;quot;; /* when you write counter(first) we will get its current value */
  font-size: 0.8em;
  font-weight: normal;
  font-style: italic;
  color: #bababa;
}
h2 {
  counter-increment: second; /* so our h2's counter goes up.. */
  counter-reset: third; /* and we reset the h3's */
}
h2:before {
  content: counter(first) &amp;quot;.&amp;quot; counter(second) &amp;quot; - &amp;quot;; /* we will output H1NUMBER.H2NUMBER */
}
h3 {
  counter-increment: third; /* h3 goes up, up, up */
}
h3:before {
  content: counter(first) &amp;quot;.&amp;quot; counter(second) &amp;quot;.&amp;quot; counter(third) &amp;quot; - &amp;quot;; /* and we output H1.H2.H3 */
}
</pre>
<p>As you can see its usage is quite simple. Our downside is that we rely on content: property and after (or before) pseudo-element so older browsers won&#8217;t see this. But it should work just fine in IE8+ and other browsers.</p>
<h2>Multiple counters</h2>
<p>Another great thing is that you can have a &#8220;general&#8221; counter, you just have to separate multiple counters to increase with spaces. Just like this:</p>
<pre class="brush: css; title: ; notranslate">
body {
  counter-reset: general first;
}
h1 {
  counter-increment: general first;
  counter-reset: second;
}
h2 {
  counter-increment: general second;
  counter-reset: third;
}
h3 {
  counter-increment: general third;
}
</pre>
<h2>Better Ordered lists</h2>
<p>Using almost the same code, you can create better ordered lists, with sub-items control.  So instead of just 1 &#8211; ITEM you can have 2.5.3.1 &#8211; ITEM when you have multiple nested OL&#8217;s. This is the code I&#8217;d use:</p>
<pre class="brush: css; title: ; notranslate">
ol {
	list-style: none;
	counter-reset: olfirst; /* our father OL must have olfirst item reseted */
	font-family: arial;
}
ol ol {
  counter-reset: olsecond; /* our sub OL's reset the olsecond, third must to be olthird and so on */
}
	ol li {
		counter-increment: olfirst; /* when we have a item that is children of first OL, it increases first counter*/
	}
	ol li ol li {
		counter-increment: olsecond; /* when the item is children of a OL that is children of another OL, so it is a sub OL */
	}
	ol li:before {
		content: counter(olfirst) &amp;quot; - &amp;quot;; /* let's output our pretty number */
	}
	ol li ol li:before {
		content: counter(olfirst) &amp;quot;.&amp;quot; counter(olsecond) &amp;quot; - &amp;quot;; /* let's output our &amp;quot;sub-number&amp;quot; */
	}
</pre>
<h2>Are you hungry yet?</h2>
<p>This is a pretty tricky attribute so you must to try it out a couple of times until you are familiar with it. But we have some tutorials at W3Schools about CSS <a href="http://www.w3schools.com/css/pr_gen_counter-reset.asp">counter reset</a>, CSS <a href="http://www.w3schools.com/css/pr_gen_counter-increment.asp">counter increment</a> and <a href="http://www.w3schools.com/css/sel_before.asp">before</a> / <a href="http://www.w3schools.com/css/sel_after.asp">after</a> pseudo elements that can help you a lot.</p>
<p>So, it is time for you to talk. Did you know about this property What do you think about it?</p>
]]></content:encoded>
			<wfw:commentRss>http://www.1stwebdesigner.com/css/css-counters-organize-ordered-content/feed/</wfw:commentRss>
		<slash:comments>20</slash:comments>
		</item>
		<item>
		<title>An Introduction to Object Oriented CSS</title>
		<link>http://www.1stwebdesigner.com/css/object-oriented-css/</link>
		<comments>http://www.1stwebdesigner.com/css/object-oriented-css/#comments</comments>
		<pubDate>Mon, 27 Jun 2011 10:00:26 +0000</pubDate>
		<dc:creator>Ranjith Kumar</dc:creator>
				<category><![CDATA[Coding]]></category>
		<category><![CDATA[HTML & CSS]]></category>
		<category><![CDATA[coding]]></category>
		<category><![CDATA[CSS design]]></category>
		<category><![CDATA[framework]]></category>
		<category><![CDATA[html]]></category>
		<category><![CDATA[semantics]]></category>
		<category><![CDATA[webdev]]></category>

		<guid isPermaLink="false">http://www.1stwebdesigner.com/?p=49102</guid>
		<description><![CDATA[With richer interactions and media heavy pages mushrooming on the web, creating web pages, which load faster and respond well has become a challenge. Separating the content, presentation and behavior of a page using HTML, CSS and JS, is not the only thing that front-end engineers have to concentrate on nowadays. The limelight is now [...]]]></description>
			<content:encoded><![CDATA[<p>With richer interactions and media heavy pages mushrooming on the web, creating web pages, which load faster and respond well has become a challenge. Separating the content, presentation and behavior of a page using HTML, CSS and JS, is not the only thing that front-end engineers have to concentrate on nowadays. The limelight is now on the performance of the pages, cleanliness and leanness of the code within, scalability and reusability of CSS, and the semantic correctness of the markup.</p>
<p>There are a handful of frameworks, techniques and approaches that are built towards this goal of maintainability, scalability and reusability of CSS. Each of them is having its own pros and cons. But, this is not a stage to elaborate on all of them.</p>
<p>This article is an introduction to implementing the concept of ‘Object Oriented Programming’ in building CSS for high scale websites and applications, with an eye on maintainability and reusability.</p>
<p><span id="more-49102"></span></p>
<h2><strong>What is OO CSS?</strong></h2>
<p><img class="alignleft size-full wp-image-49113" style="padding: 10px;" title="thmb3" src="http://cdn1.1stwebdesigner.com/wp-content/uploads/2011/06/thmb3.jpg" alt="" width="180" height="150" />The concept of ‘Object Oriented Programming’, is widespread among developers, and forms the basic for any modern programming language. Features like data abstraction, modularity and inheritance make it a favorite in coding large-scale applications.</p>
<p>Object Oriented CSS, as the name suggests, is implementing the concepts of OOP in structuring and building CSS rules, which are easy to reuse, thereby reducing the loading time and increasing the performance of web pages incredibly! The key point here is, to identify, build and style modular reusable ‘objects’ in a page, and to reuse it in multiple instances by extending them with additional features wherever needed. Here an ‘object’ refers to the basic HTML markup and its CSS rules. Apparently, here, the key challenge is going to be, identifying the ‘object’ and building rules for it.</p>
<p>This is neither a framework nor a technology, but an approach adopted in building the rules, so as to make the code more reusable, maintainable and scalable. You may already have been making use of this concept in coding your style-sheet for years, but may not be aware of this terminology :).</p>
<p>A UI engineer at Yahoo (‘<a href="http://www.stubbornella.org/content/nicole-sullivan/" target="_blank">Nicole Sullivan’ )</a> coined the term. She had made a number of presentations on the topic on various big stages (<a href="http://developer.yahoo.net/blogs/theater/archives/2009/03/website_and_webapp_performance.html">http://developer.yahoo.net/blogs/theater/archives/2009/03/website_and_webapp_performance.html</a>) and is also included in a feature on <a href="http://www.wait-till-i.com/2009/03/24/ada-lovelace-day-women-in-technology-i-admire/" target="_blank">Women in Technology</a>.</p>
<p>Nicole, who has been hired by Facebook recently, for optimizing the CSS and web page performance, has been leading the way in implementing this approach in the pages for the social networking giant, and the results are to be seen. A faster loading FB, with significantly less response time! This is exactly what this approach of building CSS promises to give back. But again, like all other frameworks, this too has pitfalls and advantages which we shall discuss in detail.</p>
<p>Following are some key aspects in object-oriented approach to CSS building:</p>
<ol>
<li>Create a component library</li>
<li>Separate container and content / Avoid Location dependent styles</li>
<li>Separate Structure and skin</li>
<li>Extend base objects using class names</li>
<li>Stick to semantic class names</li>
</ol>
<h3><strong>Create a component library</strong></h3>
<p><img class="alignleft size-full wp-image-49114" style="padding: 10px;" title="thumb4" src="http://cdn1.1stwebdesigner.com/wp-content/uploads/2011/06/thumb42.jpg" alt="" width="180" height="150" />This is the first thing to do, while building a OO CSS framework for your application, and this is the most time consuming process too. You will have to carefully study the screens of the app, and come up with the recurring reusable UI patterns, and will have to create a library consisting of HTML markup and respective CSS rules of all such components first. This may take some initial time, as you may need to filter out the components and find out the basic structure of a component, and its variations along different screens.</p>
<p>E.g. For a blog, ‘metadata (Refer to the marked area in the figure below)’ will be present in multiple instances of a page. After closer scrutiny, you will come to know that, all the metadata can have the same HTML markup, and the variations can be addressed using CSS (the font size, color, margin and padding are different in each of the occurrences of metadata component). Select a markup, as a base structure, in which you can accommodate majority of the elements that possibly can come in the particular component.</p>
<p><img class="size-full wp-image-49124 alignnone" style="padding: 10px;" title="thumb1" src="http://cdn1.1stwebdesigner.com/wp-content/uploads/2011/06/thumb13.jpg" alt="" width="574" height="430" /></p>
<p>In our example our basic structure of the ‘metadata’ component will be:</p>
<h3>Base Markup</h3>
<pre class="brush: xml; title: ; notranslate">

&lt;p class=”metadata”&gt;&lt;a&gt;Author name&lt;/a&gt;commented on&lt;a&gt;21-02-2010&lt;/a&gt;@&lt;/p&gt;
</pre>
<h3>Base rule</h3>
<pre class="brush: xml; title: ; notranslate">

.metadata{font-size:1.2em; text-align:left; margin:10px 0;}
</pre>
<p>Thus, ‘metadata’ can be now independently used within any other element in the markup, and will have a consistent look and feel, irrespective of where it is used. But as we can see in the figure above, there are multiple variations of the component. This we will tackle using CSS, and will be discussing in the following points.</p>
<p>This way, figure out all the reusable components, and create rules and markup, and group them separately in the CSS file. (It’s even fine to create a separate CSS for the component library, and then merge it with others later during deployment.)</p>
<h3><strong>Separate Content from Container / Avoid location dependent styles</strong></h3>
<p>This is one of the primary requirements of following an OO approach to building CSS files. The core idea here is to consciously differentiate the rules of containers and the content that comes within them, so that content can be plugged into any containers irrespective of their parents.</p>
<p>Often while building large-scale CSS rules there will be instances where a single component will be appearing differently in various instances, when put in different containers. One of the solutions adopted by front-end engineers, for addressing this problem was to assign location dependent selectors to that particular component.</p>
<p>E.g. With reference to the example used in the previous point, where there are multiple variations of the same component – ‘metadata’, each instance can be given location dependent rules by combining the base class ‘metadata’ with the relevant classes/IDs for the containers. i.e.,</p>
<p>‘metadata’ in a blog post can be styled as: <em>.post .metadata{overriding rules}</em><br />
‘metadata’ in a comment can be styled as: <em>.comment .metadata{overriding rules}</em><br />
‘metadata’ in a comment can be styled as: <em>.comment .metadata{overriding rules}</em></p>
<p>The OOCSS approach advocates avoiding this type of usage. Instead <strong>extend</strong> the base class by adding more classes, thereby extending the attributes of the base component to match the variation. We shall discuss the concept of extending the base class in the following points.</p>
<h3><strong>Separate structure and skin</strong></h3>
<p><a rel="attachment wp-att-49115" href="http://www.1stwebdesigner.com/css/object-oriented-css/attachment/thumb5-3/"><img class="alignleft size-full wp-image-49115" style="padding: 10px;" title="thumb5" src="http://cdn1.1stwebdesigner.com/wp-content/uploads/2011/06/thumb52.jpg" alt="" width="180" height="150" /></a>In the first point ‘Creating component library’, we discussed the importance of identifying reusable components, and building base classes and base structures for them. While creating those base rules, an important thing to keep in mind is to separate the structure and skin. In other words, while defining a base class in the component library, we should not create skin-level rules, like width, height, background images, border styles, etc, that can make the component more specific to a certain container.</p>
<p>E.g. For our base class, ‘metadata’ with the following rule</p>
<pre class="brush: css; title: ; notranslate">
.metadata{font-size:1.2em; margin:10px 0;},
</pre>
<p>Adding more skin-level rules as below,</p>
<pre class="brush: css; title: ; notranslate">

.metadata{font-size:1.2em; margin:10px 0; &lt;strong&gt;width:500px; background-color:#efefef; color:#fff;&lt;/strong&gt;},
</pre>
<p>can make it more of a specific component than a generic one, thereby making it difficult to reuse it in many other containers, which would need it to be rendered in a different ‘skin’. Also another danger of not separating structure and skin will be the ‘Specificity war’.</p>
<h3><strong>Extend base objects using class names</strong></h3>
<p><a rel="attachment wp-att-49116" href="http://www.1stwebdesigner.com/css/object-oriented-css/attachment/thumb6-3/"><img class="alignleft size-full wp-image-49116" style="padding: 10px;" title="thumb6" src="http://cdn1.1stwebdesigner.com/wp-content/uploads/2011/06/thumb62.jpg" alt="" width="180" height="150" /></a>As discussed in the second point ‘Separate content from container’, avoiding the usage of contextual selectors will make the content independent from their parent containers and hence will be truly usable across the application. So how do we instantiate the variations of the same object in different containers? What is the solution? Well here comes the concept of <strong>extending</strong> the base ‘object’ (again another term coined by Nicole Sullivan), by adding more class names to it depending on the context, rather than tightly coupling the object with the class names of the containers in which it is to be placed.</p>
<p>E.g. In the first figure of the ‘metadata’ object, where the same object needs to be rendered differently in various containers,</p>
<p>The HTML markup of each of them will look like:</p>
<pre class="brush: xml; title: ; notranslate">
&lt;p class=”metadata commentmetadata”&gt;&lt;a&gt;Authorname&lt;/a&gt;commented on&lt;a&gt;21-02-2010&lt;/a&gt;@&lt;/p&gt;
&lt;p class=”metadata postmetadata”&gt;&lt;a&gt;Authorname&lt;/a&gt;commented on&lt;a&gt;21-02-2010&lt;/a&gt;@&lt;/p&gt;
&lt;p class=”metadata authorlistmetadata”&gt;&lt;a&gt;Authorname&lt;/a&gt;commented on&lt;a&gt;21-02-2010&lt;/a&gt;@&lt;/p&gt;
</pre>
<p>The CSS rules will be:</p>
<pre class="brush: css; title: ; notranslate">

.metadata{font-size:1.2em; margin:10px 0;}
.commentmetadata{font-size:1em; margin:0 0 10px 0; color:#063070; }
.postmetadata{ color:#063070; }
.authormetadata{ color:#fff; }
</pre>
<p>This is a very simple demonstration, to comprehend the concept of implementing OO programming. As the size of the app becomes larger, the UI patterns will become more complex, and there lies the actual challenge and advantage of using such an approach.</p>
<h3><strong>Stick to semantic class names</strong></h3>
<p>A challenge in building CSS for high-scale web applications is to logically come up with meaningful class / ID names matching with the context and moreover making sure, they are reusable and still make sense. With the concept of ‘extending’ base objects, it’s easy to fall into the practice of creating ‘presentational class names’. Some easy examples are ‘leftCol’, ‘redText’, ‘midCol’, ‘bigText’, ‘bolderText’ etc. Such class names are not reusable and are a hindrance to scalability.</p>
<p>Always stick to logical and semantic class names relating to the logical meaning of the component, rather than its presentational meaning. It means, instead of giving the text block with a yellow background color, the class name ‘yellowText’, ‘notification’ would be a more sensible name, as it is a notification element that pops out to notify some activities within the system.<strong> </strong></p>
<h3><strong>Pros and Cons?</strong></h3>
<p>Following such an approach of building CSS has its own pitfalls and advantages</p>
<p>Here are a few cases, where adopting such a framework ‘may’ backfire:</p>
<ol>
<li>OOCSS is suited to really large websites / application which are filled with reusable components. It may not give desired results in smaller websites and applications. So decide sensibly depending on the size of the work in hand</li>
<li>If not smartly used, creating the component library can turn out to be a mess, and become a maintenance nightmare for other coders</li>
<li>Documentation is a must. Each block of code should be clearly commented out with the right points for other coders to absorb the concept, which otherwise can become too tedious in case of a knowledge transition</li>
</ol>
<p>Some obvious advantages of adopting this approach are:</p>
<ol>
<li>Less lines of CSS code</li>
<li>Cleaner HTML markup, with logically sensible class names and hierarchy</li>
<li>Semantic markup, means more SEO friendly pages</li>
<li>Far better page optimization, with much faster loading times, since most of the components are reused</li>
<li>Scalable markup and CSS code, where more components can be added into the library without disturbing other components, as the base objects are independent of any other containers</li>
<li>Easily theme-able layouts, since changes to the base object can completely change almost the whole presentation layer instantly</li>
</ol>
<h3><strong>Courtesy &amp; Resources</strong></h3>
<p><a href="http://www.stubbornella.org/content/2009/02/28/object-oriented-css-grids-on-github/">http://www.webdirections.org/blog/object-oriented-css-the-video/</p>
<p>http://www.stubbornella.org/content/2009/02/28/object-oriented-css-grids-on-github/</a></p>
<p><a href="http://www.iconfinder.com">http://www.iconfinder.com</a> for all the icon resources</p>
]]></content:encoded>
			<wfw:commentRss>http://www.1stwebdesigner.com/css/object-oriented-css/feed/</wfw:commentRss>
		<slash:comments>13</slash:comments>
		</item>
	</channel>
</rss>

