<?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>Oncemade &#187; jQuery</title>
	<atom:link href="http://oncemade.com/tag/jquery/feed/" rel="self" type="application/rss+xml" />
	<link>http://oncemade.com</link>
	<description>Design, Web Dev, Inspiration</description>
	<lastBuildDate>Fri, 09 Jul 2010 02:06:26 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>Nice input labels using jQuery and CSS</title>
		<link>http://oncemade.com/nice-input-labels/</link>
		<comments>http://oncemade.com/nice-input-labels/#comments</comments>
		<pubDate>Thu, 01 Jul 2010 19:41:01 +0000</pubDate>
		<dc:creator>Rodrigo</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[HTML]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[UX]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[accessibility]]></category>
		<category><![CDATA[form]]></category>
		<category><![CDATA[label]]></category>

		<guid isPermaLink="false">http://oncemade.com/?p=936</guid>
		<description><![CDATA[Nowadays it's very common to find websites "hiding" form labels in favor of input's default text. Even tough it's a [...]]]></description>
			<content:encoded><![CDATA[<p>Nowadays it's very common to find websites "hiding" form labels in favor of input's default text. Even tough it's a cleaver idea, there is a better way to accomplish the same result without compromising accessibility.</p>

<p>First step is to create the form. I usually have all my forms inside a list:</p>
<p><strong>UPDATE: It's necessary to turn off the "autocomplete" so the inputs don't get messed up.</strong></p>
<pre>
<h4>markup</h4><code>&lt;form action=""&gt;
  &lt;ul&gt;
   &lt;li&gt;
    &lt;label for="username"&gt;Username&lt;/label&gt;
    &lt;input id="username" type="text" autocomplete="off" /&gt;
   &lt;/li&gt;
   &lt;li&gt;
    &lt;label for="password"&gt;Password&lt;/label&gt;
    &lt;input id="password" type="password" autocomplete="off" /&gt;
   &lt;/li&gt;
   &lt;li&gt;
    &lt;input type="submit" value="login" /&gt;
   &lt;/li&gt;
  &lt;/ul&gt;
&lt;/form&gt;</code></pre>
<p>Don't forget the <strong>"for"</strong> attribute, the script will rely on it. Go ahead and add the following CSS:</p>
<pre><h4>CSS</h4><code>form li { position: relative; }
label {
  position: absolute;
  top: 5px; // adjust as needed
  left: 5px;
}
//remove absolute position if the label comes after
//the input. Eg. a checkbox with a text next to it
input + label { position: static; }</code></pre>
<span id="more-936"></span>

<p>Now the final touch. With some jQuery magic, lets make the label disappear on focus.</p>
<pre><h4>jQuery</h4>
<code>//loop through all text inputs, password inputs and textarea
var inputs = $('input[type="text"], textarea, input[type="password"]');

// remove label on focus
inputs.focus(function(){
  $('label[for="'+$(this).attr('id')+'"]').hide();
});
inputs.blur(function(){
  var that = $(this);
  if (that.val() == ""){
    $('label[for="'+that.attr('id')+'"]').show();
  }
});
inputs.blur();</code></pre>
<h4>Demo</h4>
<div id="example"><form>
<ul>
	<li> <label for="username">Username</label>

<input id="username" type="text" autocomplete="off" /></li>
	<li> <label for="password">Password</label>

<input id="password" type="password" autocomplete="off" /></li>
	<li> <input type="submit" value="Login" /></li>
</ul>
</form></div>]]></content:encoded>
			<wfw:commentRss>http://oncemade.com/nice-input-labels/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Animated Page Scroll with jQuery</title>
		<link>http://oncemade.com/animated-page-scroll-with-jquery/</link>
		<comments>http://oncemade.com/animated-page-scroll-with-jquery/#comments</comments>
		<pubDate>Tue, 28 Jul 2009 16:00:34 +0000</pubDate>
		<dc:creator>Rodrigo</dc:creator>
				<category><![CDATA[Javascript]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[animation]]></category>
		<category><![CDATA[scroll]]></category>

		<guid isPermaLink="false">http://oncemade.com/?p=613</guid>
		<description><![CDATA[Lately I've been seeing lots of websites using animated page scroll, it can be easily done with the help of [...]]]></description>
			<content:encoded><![CDATA[<p>Lately I've been seeing lots of websites using animated page scroll, it can be easily done with the help of <a href="http://jquery.com">jQuery</a>. Here is how:</p>

<pre><h4>jQuery Code</h4><code>$(&#x27;.scrollPage&#x27;).click(function() {
   var elementClicked = $(this).attr(&quot;href&quot;);
   var destination = $(elementClicked).offset().top;
   $(&quot;html:not(:animated),body:not(:animated)&quot;).animate({ scrollTop: destination-20}, 500 );
   return false;
});</code></pre>

<p>The code gets the <em>href</em> from the anchor and uses it as the target element. If you want to adjust the scroll speed just change the 500.</p>

<p>Don't forget to checkout the live demo</p>

<a href="http://examples.oncemade.com/2009/07/animated-page-scroll-with-jquery-example/" title="jQuery Page Scroll Demo" class="demoBtn" target="_blank">Demo</a>

<h4>Browser Support</h4>
<ul class="browserComp clearfix">
   <li class="firefoxComp"><span>Firefox</span></li>
   <li class="safariComp"><span>Safari</span></li>
   <li class="chromeComp"><span>Chrome</span></li>
   <li class="operaComp"><span>Opera</span></li>
   <li class="ie7Comp"><span>Internet Explore 7 &amp; 8</span></li>
<li class="ie6Comp"><span>Internet Explore 6</span></li>
</ul>]]></content:encoded>
			<wfw:commentRss>http://oncemade.com/animated-page-scroll-with-jquery/feed/</wfw:commentRss>
		<slash:comments>25</slash:comments>
		</item>
	</channel>
</rss>
