<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:sy="http://purl.org/rss/1.0/modules/syndication/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:creativeCommons="http://backend.userland.com/creativeCommonsRssModule" version="2.0">

<channel>
	<title>Yelotofu</title>
	
	<link>http://www.yelotofu.com</link>
	<description>"In building standards compliant sites we are creating a better Web for the future."</description>
	<lastBuildDate>Sun, 11 Mar 2012 12:34:40 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1.3</generator>
		<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/Yelotofu" /><feedburner:info xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" uri="yelotofu" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><creativeCommons:license>http://creativecommons.org/licenses/by-sa/3.0/</creativeCommons:license><image><link>http://creativecommons.org/licenses/by-sa/3.0/</link><url>http://creativecommons.org/images/public/somerights20.gif</url><title>Some Rights Reserved</title></image><item>
		<title>Reverse Inline Editing</title>
		<link>http://www.yelotofu.com/2012/03/reverse-inline-editing/</link>
		<comments>http://www.yelotofu.com/2012/03/reverse-inline-editing/#comments</comments>
		<pubDate>Sun, 11 Mar 2012 12:34:15 +0000</pubDate>
		<dc:creator>caphun</dc:creator>
				<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[Ramblings]]></category>
		<category><![CDATA[editable]]></category>
		<category><![CDATA[inlineedit]]></category>

		<guid isPermaLink="false">http://www.yelotofu.com/?p=841</guid>
		<description><![CDATA[I want to throw this out there as I'm wondering if anyone is interested in a different approach to making HTML elements editable... I recently wrote some code that does the reverse of what my existing inlineEdit plugin does. i.e. it starts of as a form input element and turns into a placeholder on load. [...]]]></description>
			<content:encoded><![CDATA[<p>I want to throw this out there as I'm wondering if anyone is interested in a different approach to <a href="http://www.yelotofu.com/2009/08/jquery-inline-edit-tutorial/" target="_blank">making HTML elements editable</a>... I recently wrote some code that does the reverse of what my <a href="https://github.com/caphun/jquery.inlineedit">existing inlineEdit plugin</a> does. i.e. it starts of as a form input element and turns into a placeholder on load. Once loaded up you can do all the same saving/canceling as the usual editable elements but the beauty now is that underneath it's a plain old form element so degrades nicely if you also wish to cater for non-javascript users. So I wonder which approach is best? What are the pros and cons? Or should a plugin cater for both scenarios?</p>

<p><a href="http://feedads.g.doubleclick.net/~a/mOFAdoB_fXAYzQhkaKPVWnpjbWg/0/da"><img src="http://feedads.g.doubleclick.net/~a/mOFAdoB_fXAYzQhkaKPVWnpjbWg/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/mOFAdoB_fXAYzQhkaKPVWnpjbWg/1/da"><img src="http://feedads.g.doubleclick.net/~a/mOFAdoB_fXAYzQhkaKPVWnpjbWg/1/di" border="0" ismap="true"></img></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.yelotofu.com/2012/03/reverse-inline-editing/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>jQHK: A study of the Parallax Effect</title>
		<link>http://www.yelotofu.com/2012/03/jqhk-a-study-of-the-parallax-effect/</link>
		<comments>http://www.yelotofu.com/2012/03/jqhk-a-study-of-the-parallax-effect/#comments</comments>
		<pubDate>Wed, 29 Feb 2012 18:22:32 +0000</pubDate>
		<dc:creator>caphun</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[jQuery Hong Kong]]></category>
		<category><![CDATA[jqhk]]></category>
		<category><![CDATA[jqueryhk]]></category>
		<category><![CDATA[jqueryhongkong]]></category>
		<category><![CDATA[parallaxeffect]]></category>

		<guid isPermaLink="false">http://www.yelotofu.com/?p=827</guid>
		<description><![CDATA[In our recent jQuery HK meetup we explored the technic behind the parallax effect using Nike Better World as a reference for our live coding session. The core idea of the effect is: bind each section, sprite and background to the window scroll event record the original offset of the element divide the scroll position [...]]]></description>
			<content:encoded><![CDATA[<p>In our recent jQuery HK meetup we explored the technic behind the parallax effect using <a href="http://nikebetterworld.com/about" target="_blank">Nike Better World</a> as a reference for our live coding session.</p>
<p>The core idea of the effect is:</p>
<ol>
<li>bind each section, sprite and background to the window scroll event</li>
<li>record the original offset of the element</li>
<li>divide the scroll position by the desired speed of the element and discount the original offset value</li>
<li>apply varying speeds to elements as desired to create the parallax effect</li>
<li>for the nikebetterworld specific effect where the background image overlaps that's done with <code>background-attachment: fixed</code></li>
</ol>
<p><a href="http://jsbin.com/eyaviz/edit#javascript,html" target="_blank">Here's what we came up with.</a></p>
<p>N.B. Sorry about the Angry bird theme for those who try to run the script. That's quite a big hit over here for Kongers of all age groups! <img src='http://www.yelotofu.com/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' /> </p>

<p><a href="http://feedads.g.doubleclick.net/~a/w9s35kjkSArxUwpkG0qDr4YA2HE/0/da"><img src="http://feedads.g.doubleclick.net/~a/w9s35kjkSArxUwpkG0qDr4YA2HE/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/w9s35kjkSArxUwpkG0qDr4YA2HE/1/da"><img src="http://feedads.g.doubleclick.net/~a/w9s35kjkSArxUwpkG0qDr4YA2HE/1/di" border="0" ismap="true"></img></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.yelotofu.com/2012/03/jqhk-a-study-of-the-parallax-effect/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>First steps to using jQuery with CoffeeScript</title>
		<link>http://www.yelotofu.com/2012/02/first-steps-to-using-jquery-with-coffeescript/</link>
		<comments>http://www.yelotofu.com/2012/02/first-steps-to-using-jquery-with-coffeescript/#comments</comments>
		<pubDate>Sat, 11 Feb 2012 17:52:35 +0000</pubDate>
		<dc:creator>caphun</dc:creator>
				<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[coffeescript]]></category>
		<category><![CDATA[firststeps]]></category>

		<guid isPermaLink="false">http://www.yelotofu.com/?p=792</guid>
		<description><![CDATA[A colleague recently asked me how you typically write the jQuery DomReady and closure syntaxes with CoffeeScript. It's actually quite simple but did require a bit of fiddling around to find the right recipe. So I thought I'd share this with you all just in case you're wondering too! DomReady: CoffeeScript jQuery ($) -&#62; # [...]]]></description>
			<content:encoded><![CDATA[<p>A colleague recently asked me how you typically write the jQuery DomReady and closure syntaxes with <a href="http://coffeescript.org/" target="_blank">CoffeeScript</a>. It's actually quite simple but did require a bit of fiddling around to find the right recipe. So I thought I'd share this with you all just in case you're wondering too!</p>
<h4>DomReady:</h4>
<p><b>CoffeeScript</b></p>
<pre class="brush: ruby; title: ;">
jQuery ($) -&gt;
  # your code here!
</pre>
<p><b>JavaScript</b></p>
<pre class="brush: jscript; title: ;">
jQuery(function($) {
  // your code here!
});
</pre>
<h4>DomReady v2:</h4>
<p><b>CoffeeScript</b></p>
<pre class="brush: ruby; title: ;">
$(document).ready -&gt;
  # your code here!
</pre>
<p><b>JavaScript</b></p>
<pre class="brush: jscript; title: ;">
$(document).ready(function() {
  // your code here!
});
</pre>
<h4>Passing jQuery into a closure:</h4>
<p><b>CoffeeScript</b></p>
<pre class="brush: ruby; title: ;">
(($) -&gt;
  # your code here!
) jQuery
</pre>
<p><b>JavaScript</b></p>
<pre class="brush: jscript; title: ;">
(function($) {
  // your code here!
})(jQuery);
</pre>
<p>Do you have a recipe for this too? What is it?</p>

<p><a href="http://feedads.g.doubleclick.net/~a/-C54qd3g4NO0fj8BXtSN-nIur2k/0/da"><img src="http://feedads.g.doubleclick.net/~a/-C54qd3g4NO0fj8BXtSN-nIur2k/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/-C54qd3g4NO0fj8BXtSN-nIur2k/1/da"><img src="http://feedads.g.doubleclick.net/~a/-C54qd3g4NO0fj8BXtSN-nIur2k/1/di" border="0" ismap="true"></img></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.yelotofu.com/2012/02/first-steps-to-using-jquery-with-coffeescript/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>jQuery Sticky Sidebar</title>
		<link>http://www.yelotofu.com/2011/09/jquery-sticky-sidebar/</link>
		<comments>http://www.yelotofu.com/2011/09/jquery-sticky-sidebar/#comments</comments>
		<pubDate>Sun, 11 Sep 2011 18:00:00 +0000</pubDate>
		<dc:creator>caphun</dc:creator>
				<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[jquerystickysidebar]]></category>
		<category><![CDATA[stickysidebar]]></category>

		<guid isPermaLink="false">http://www.yelotofu.com/?p=781</guid>
		<description><![CDATA[This is something I wrote in a few hours so thought I'd share it with the world. It mimics the sidebar UX seen on Apple and Amazons purchase flows. I tried to keep this as simple as possible. There are two states the plugin determines - Sticky and non-Sticky. When the Sidebar is sticky its [...]]]></description>
			<content:encoded><![CDATA[<p>This is something I wrote in a few hours so thought I'd share it with the world.  It mimics the sidebar UX seen on Apple and Amazons purchase flows. I tried to keep this as simple as possible. There are two states the plugin determines - Sticky and non-Sticky. When the Sidebar is sticky its <code>position:fixed</code>, when non-Sticky it's <code>position:absolute</code>. The plugin determines one or the other by checking where you've scrolled to. The window of stickiness starts from the point you past the adjacent main content up until the sidebar reaches the bottom of the adjacent main content. <a href="http://www.yelotofu.com/labs/stickysidebar/demo.html" target="_blank">Check the demo and all will be clear!</a></p>
<p>Source code on github at<br />
<a href="https://github.com/caphun/jquery.stickysidebar" target="_blank">https://github.com/caphun/jquery.stickysidebar</a></p>
<p>Enjoy! <img src='http://www.yelotofu.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>

<p><a href="http://feedads.g.doubleclick.net/~a/5Mg9igA5lI5WlVtOdHoh_t5jKrM/0/da"><img src="http://feedads.g.doubleclick.net/~a/5Mg9igA5lI5WlVtOdHoh_t5jKrM/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/5Mg9igA5lI5WlVtOdHoh_t5jKrM/1/da"><img src="http://feedads.g.doubleclick.net/~a/5Mg9igA5lI5WlVtOdHoh_t5jKrM/1/di" border="0" ismap="true"></img></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.yelotofu.com/2011/09/jquery-sticky-sidebar/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>jQuery Cycle and Fullscreen</title>
		<link>http://www.yelotofu.com/2011/06/jquery-cycle-and-fullscreen/</link>
		<comments>http://www.yelotofu.com/2011/06/jquery-cycle-and-fullscreen/#comments</comments>
		<pubDate>Fri, 17 Jun 2011 14:57:37 +0000</pubDate>
		<dc:creator>caphun</dc:creator>
				<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[cycle]]></category>
		<category><![CDATA[fullscreen]]></category>
		<category><![CDATA[plugin]]></category>

		<guid isPermaLink="false">http://yelotofu.com/?p=752</guid>
		<description><![CDATA[jQuery Cycle is an excellent plugin and the most extensible jquery plugin I've seen thus far. It works surprisingly well and is very accommodating to all sorts of external html/css setups. However there is an itch to scratch when it comes to fullscreen sliding. The Cycle plugin doesn't quite support this well enough. Fortunately the [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://jquery.malsup.com/cycle/">jQuery Cycle</a> is an excellent plugin and the most extensible jquery plugin I've seen thus far. It works surprisingly well and is very accommodating to all sorts of external html/css setups. </p>
<p>However there is an itch to scratch when it comes to fullscreen sliding. The Cycle plugin doesn't quite support this well enough. Fortunately the Transition Effects architecture allows us to write custom transitions to overcome this problem.</p>
<pre class="brush: jscript; title: ;">
/* Ca-Phun Ung &lt; caphun at tofugear dot com&gt;
 * Support for fullscreen horizontal scroll transitions.
 */
$.fn.cycle.transitions.scrollMaxHoriz = function($cont, $slides, opts) {
    var w = $(window).width();
    if (opts.minWidth &amp;&amp; w &lt; opts.minWidth) w = opts.minWidth;
	opts.before.push(function(curr, next, opts, fwd) {
		if (opts.rev)
			fwd = !fwd;
        curr.cycleW = next.cycleW = w;
		$.fn.cycle.commonReset(curr,next,opts);
		opts.cssBefore.left = fwd ? (next.cycleW-1) : (1-next.cycleW);
		opts.animOut.left = fwd ? -curr.cycleW : curr.cycleW;
	});
	opts.cssFirst.left = 0;
	opts.cssBefore.top = 0;
	opts.animIn.left = 0;
	opts.animOut.top = 0;
};
</pre>
<p>As you may notice in the above transition I'm only dealing with screen width hence I call this the scrollMaxHoriz transition. Now how to use this code? First load it as part of your javascript library stack then in your cycle call you can:</p>
<pre class="brush: jscript; title: ;">
$('.my-slides').cycle({
  fx: 'scrollMaxHoriz', // use custom scrollMax transition plugin
  minWidth: 1057 // optional
});
</pre>
<p>That's it!</p>

<p><a href="http://feedads.g.doubleclick.net/~a/iXgj7y5RIlUhJjXxuJvXDCafKM8/0/da"><img src="http://feedads.g.doubleclick.net/~a/iXgj7y5RIlUhJjXxuJvXDCafKM8/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/iXgj7y5RIlUhJjXxuJvXDCafKM8/1/da"><img src="http://feedads.g.doubleclick.net/~a/iXgj7y5RIlUhJjXxuJvXDCafKM8/1/di" border="0" ismap="true"></img></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.yelotofu.com/2011/06/jquery-cycle-and-fullscreen/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>Customizing the WordPress Admin Interface</title>
		<link>http://www.yelotofu.com/2010/12/customizing-the-wordpress-admin-interface/</link>
		<comments>http://www.yelotofu.com/2010/12/customizing-the-wordpress-admin-interface/#comments</comments>
		<pubDate>Fri, 03 Dec 2010 07:22:12 +0000</pubDate>
		<dc:creator>caphun</dc:creator>
				<category><![CDATA[WordPress]]></category>

		<guid isPermaLink="false">http://yelotofu.com/?p=739</guid>
		<description><![CDATA[Six Revisions have an excellent post on how to customize the WordPress admin area. However I was looking also at a way of removing the Plugin Editor menu and noticed you can't remove it like you do with the Theme Editor menu because it's not added via an action. So I added this to my [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://sixrevisions.com/">Six Revisions</a> have an excellent post on <a href="http://sixrevisions.com/wordpress/how-to-customize-the-wordpress-admin-area/">how to customize the WordPress admin area</a>.</p>
<p>However I was looking also at a way of removing the Plugin Editor menu and noticed you can't remove it like you do with the Theme Editor menu because it's not added via an action. So I added this to my theme's <code>functions.php</code>:</p>
<pre class="brush: php; title: ;">
add_action('_admin_menu', 'remove_plugin_editor_menu', 1);

if ( ! function_exists( 'remove_plugin_editor_menu') ):

function remove_plugin_editor_menu() {
  global $submenu;
  unset($submenu['plugins.php'][15]);
}

endif;
</pre>
<p>It's very hacky because I'm targetting the index value of the <code>$submenu</code> array. If anyone knows a better way then I'd love to here it!</p>

<p><a href="http://feedads.g.doubleclick.net/~a/hP7EBwPm-tzi96BiQHhnIyG1ePM/0/da"><img src="http://feedads.g.doubleclick.net/~a/hP7EBwPm-tzi96BiQHhnIyG1ePM/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/hP7EBwPm-tzi96BiQHhnIyG1ePM/1/da"><img src="http://feedads.g.doubleclick.net/~a/hP7EBwPm-tzi96BiQHhnIyG1ePM/1/di" border="0" ismap="true"></img></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.yelotofu.com/2010/12/customizing-the-wordpress-admin-interface/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>HowTo: Revert local changes in Git</title>
		<link>http://www.yelotofu.com/2010/08/howto-revert-local-changes-git/</link>
		<comments>http://www.yelotofu.com/2010/08/howto-revert-local-changes-git/#comments</comments>
		<pubDate>Sat, 28 Aug 2010 10:06:06 +0000</pubDate>
		<dc:creator>caphun</dc:creator>
				<category><![CDATA[Ramblings]]></category>
		<category><![CDATA[checkout]]></category>
		<category><![CDATA[git]]></category>
		<category><![CDATA[reset]]></category>
		<category><![CDATA[revert]]></category>

		<guid isPermaLink="false">http://yelotofu.com/?p=676</guid>
		<description><![CDATA[Found this answer on Stack Overflow very useful, so thought I'd share it here: If you want to revert changes made to your working copy, do this: git checkout . If you want to revert changes made to the index (i.e., that you have added), do this: git reset If you want to revert a [...]]]></description>
			<content:encoded><![CDATA[<p>Found <a href="http://stackoverflow.com/questions/1146973/how-to-revert-all-local-changes-in-a-git-managed-project-to-previous-state/1146981#1146981">this answer</a> on Stack Overflow very useful, so thought I'd share it here:</p>
<blockquote>
<p>If you want to revert changes made to your working copy, do this:</p>
<p><code>git checkout .</code></p>
<p>If you want to revert changes made to the index (i.e., that you have added), do this:</p>
<p><code>git reset</code></p>
<p>If you want to revert a change that you have committed, do this:</p>
<p><code>git revert ...</code></p>
</blockquote>
<p><small><strong>Source:</strong> <a href="http://stackoverflow.com/questions/1146973/how-to-revert-all-local-changes-in-a-git-managed-project-to-previous-state/1146981#1146981">How to revert all local changes in a GIT managed project to previous state ?</a></small></p>

<p><a href="http://feedads.g.doubleclick.net/~a/1qHclAAaRZuCP-Lfl9cOqaJG5UM/0/da"><img src="http://feedads.g.doubleclick.net/~a/1qHclAAaRZuCP-Lfl9cOqaJG5UM/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/1qHclAAaRZuCP-Lfl9cOqaJG5UM/1/da"><img src="http://feedads.g.doubleclick.net/~a/1qHclAAaRZuCP-Lfl9cOqaJG5UM/1/di" border="0" ismap="true"></img></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.yelotofu.com/2010/08/howto-revert-local-changes-git/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>How to get Fancybox 1.3.1 to stay put!</title>
		<link>http://www.yelotofu.com/2010/06/how-to-get-fancybox-1-3-1-to-stay-put/</link>
		<comments>http://www.yelotofu.com/2010/06/how-to-get-fancybox-1-3-1-to-stay-put/#comments</comments>
		<pubDate>Mon, 07 Jun 2010 04:11:41 +0000</pubDate>
		<dc:creator>caphun</dc:creator>
				<category><![CDATA[Ramblings]]></category>

		<guid isPermaLink="false">http://yelotofu.com/?p=655</guid>
		<description><![CDATA[I recently had a need to use a Fixed position overlay and found that Fancybox breaks if I set #fancybox-wrap to position:fixed. I believe the centerOnScroll option was supposed to solve this problem by recalculating the absolute position of #fancybox-wrap upon scrolling. The problem with this approach is that the overlay 'shudders' or 'feels jumpy' [...]]]></description>
			<content:encoded><![CDATA[<p>I recently had a need to use a Fixed position overlay and found that Fancybox breaks if I set <code>#fancybox-wrap</code> to <code>position:fixed</code>. I believe the <code>centerOnScroll</code> option was supposed to solve this problem by recalculating the absolute position of <code>#fancybox-wrap</code> upon scrolling. The problem with this approach is that the overlay 'shudders' or 'feels jumpy' when you scroll in Firefox, Opera and IE7+.</p>
<p>Luckily the fix is actually pretty simple with the following steps:</p>
<p><strong>1. Get a copy of the source code</strong> - <a href="http://fancybox.googlecode.com/files/jquery.fancybox-1.3.1.zip">jquery.fancybox-1.3.1.zip</a></p>
<p><strong>2. Do a in-code-search</strong> </p>
<p>Open jquery.fancybox-1.3.1.js and look for the <code>fancybox_get_viewport</code> function (should be around line 56), the function should look like this:</p>
<pre class="brush: jscript; title: ;">
fancybox_get_viewport = function() {
  return [ $(window).width(), $(window).height(), $(document).scrollLeft(), $(document).scrollTop() ];
},
</pre>
<p><strong>3. Change it to look like this:</strong></p>
<pre class="brush: jscript; title: ;">
fancybox_get_viewport = function() {
  var isFixed = wrap.css('position') === 'fixed'; // add support for fixed positioning
  return [ $(window).width(), $(window).height(), isFixed ? 0 : $(document).scrollLeft(), isFixed ? 0 : $(document).scrollTop() ];
},
</pre>
<p><strong>4. Add some CSS</strong></p>
<p>Add the following clauses to your CSS files (ensure these clauses load <em>after</em> the jquery.fancybox-1.3.1.css file):</p>
<pre class="brush: css; title: ;">
#fancybox-wrap {
  position: fixed;
}
* html #fancybox-wrap {	/* IE6 */
  position: absolute;
}
</pre>
<p>That's it!</p>
<p>Basically what the fix does is detect whether the wrapper is a fixed position element, if so it would return 0 for the scrollLeft and scrollTop values of the viewport. So even if you're not using a fixed position element you can add this fix in as it's non-destructive.</p>

<p><a href="http://feedads.g.doubleclick.net/~a/Vn1KTI4KHGDc2wzcJHQe-ZAojPg/0/da"><img src="http://feedads.g.doubleclick.net/~a/Vn1KTI4KHGDc2wzcJHQe-ZAojPg/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/Vn1KTI4KHGDc2wzcJHQe-ZAojPg/1/da"><img src="http://feedads.g.doubleclick.net/~a/Vn1KTI4KHGDc2wzcJHQe-ZAojPg/1/di" border="0" ismap="true"></img></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.yelotofu.com/2010/06/how-to-get-fancybox-1-3-1-to-stay-put/feed/</wfw:commentRss>
		<slash:comments>10</slash:comments>
		</item>
		<item>
		<title>HTML5 Placeholders</title>
		<link>http://www.yelotofu.com/2010/06/tip-the-html5-placeholder/</link>
		<comments>http://www.yelotofu.com/2010/06/tip-the-html5-placeholder/#comments</comments>
		<pubDate>Tue, 01 Jun 2010 18:47:46 +0000</pubDate>
		<dc:creator>caphun</dc:creator>
				<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[html5]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[placeholder]]></category>
		<category><![CDATA[placeholders]]></category>

		<guid isPermaLink="false">http://yelotofu.com/?p=633</guid>
		<description><![CDATA[HTML5 adds a new attribute to most form elements called a placeholder. Its purpose is to add a short hint inside data entry points that disappear on focus. This type of interaction isn't new but is new to HTML as of version 5. For this reason not all browsers have implemented this feature. Try it [...]]]></description>
			<content:encoded><![CDATA[<p>HTML5 adds a new attribute to most form elements called a <a href="http://dev.w3.org/html5/spec/Overview.html#the-placeholder-attribute">placeholder</a>. Its purpose is to add a short hint inside data entry points that disappear on focus. This type of interaction isn't new but is new to HTML as of version 5. For this reason not all browsers have implemented this feature. Try it to see which of your browsers support the following bit of code!</p>
<p><strong>HTML</strong></p>
<pre class="brush: xml; title: ;">
&lt;input type=&quot;text&quot; placeholder=&quot;click me!&quot;&gt;
</pre>
<p>So now we have a problem. Some browsers support it and others don't!? Foresee client issues? Not to worry, here's a workaround using the latest jQuery 1.4 features!</p>
<p><strong>JavaScript</strong></p>
<pre class="brush: jscript; title: ;">
jQuery(document).ready(function($) {

  // first check if placeholder attribute is supported
  if ($('&lt;input/&gt;')
        .attr('placeholder','')[0]
        .placeholder === undefined) {

    // text input placeholder
    $('input[placeholder]')
      .each(function() {
        this.value === ''
          ? this.value = $(this).attr('placeholder')
          : false;
      })
      .live('focusin focusout', function(event) {
        event.type == 'focusout' &amp;&amp; this.value === ''
          ? this.value = $(this).attr('placeholder')
          : this.value === $(this).attr('placeholder')
            ? this.value = ''
            : false;
      });

  }

});
</pre>
<p>This is not a complete solution as there are other things to consider such as visual style and what happens when you submit the form. But I'll let you mull over those. <img src='http://www.yelotofu.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>Demo and code sample: <a href="http://jsbin.com/ujosa/edit">http://jsbin.com/ujosa/edit</a></p>

<p><a href="http://feedads.g.doubleclick.net/~a/BXG1UJkorvF6BH2Xas9_5lJJeuw/0/da"><img src="http://feedads.g.doubleclick.net/~a/BXG1UJkorvF6BH2Xas9_5lJJeuw/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/BXG1UJkorvF6BH2Xas9_5lJJeuw/1/da"><img src="http://feedads.g.doubleclick.net/~a/BXG1UJkorvF6BH2Xas9_5lJJeuw/1/di" border="0" ismap="true"></img></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.yelotofu.com/2010/06/tip-the-html5-placeholder/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>jQuery: Textarea maxlength</title>
		<link>http://www.yelotofu.com/2009/12/jquery-textarea-max-length/</link>
		<comments>http://www.yelotofu.com/2009/12/jquery-textarea-max-length/#comments</comments>
		<pubDate>Sun, 13 Dec 2009 10:00:38 +0000</pubDate>
		<dc:creator>caphun</dc:creator>
				<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[html]]></category>
		<category><![CDATA[HTML 5]]></category>
		<category><![CDATA[html5]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[maxlength]]></category>
		<category><![CDATA[textarea]]></category>

		<guid isPermaLink="false">http://yelotofu.com/?p=597</guid>
		<description><![CDATA[Being able to restrict the maximum length of user input from the interface directly is very convenient and practical in use. We do this a lot with input elements. Unfortunately textarea elements do not natively support the maxlength attribute. This attribute was finally added in HTML5 but at the time of writing Chrome is the [...]]]></description>
			<content:encoded><![CDATA[<p>Being able to restrict the maximum length of user input from the interface directly is very convenient and practical in use. We do this a lot with <code>input</code> elements. Unfortunately <code>textarea</code> elements do not natively support the <code>maxlength</code> attribute. This attribute was finally added in HTML5 but at the time of writing Chrome is the only browser supporting it.</p>
<p>Naturally many have used JavaScript to rectify this problem and I'd be doing the same here. The difference is we won't be putting anything special in the markup but will simply use the <code>maxlength</code> attribute within our <code>textarea</code> as if it's native &mdash;  like so:</p>
<p><strong>HTML</strong></p>
<pre class="brush: xml; title: ;">
&lt;textarea cols=&quot;30&quot; rows=&quot;5&quot; maxlength=&quot;10&quot;&gt;&lt;/textarea&gt;
</pre>
<p>This is looking good for HTML5 compatibility. And here's the magic:</p>
<p><strong>jQuery</strong> </p>
<pre class="brush: jscript; title: ;">
jQuery(function($) {

  // ignore these keys
  var ignore = [8,9,13,33,34,35,36,37,38,39,40,46];

  // use keypress instead of keydown as that's the only
  // place keystrokes could be canceled in Opera
  var eventName = 'keypress';

  // handle textareas with maxlength attribute
  $('textarea[maxlength]')

    // this is where the magic happens
    .live(eventName, function(event) {
      var self = $(this),
          maxlength = self.attr('maxlength'),
          code = $.data(this, 'keycode');

      // check if maxlength has a value.
      // The value must be greater than 0
      if (maxlength &amp;&amp; maxlength &gt; 0) {

        // continue with this keystroke if maxlength
        // not reached or one of the ignored keys were pressed.
        return ( self.val().length &lt; maxlength
                 || $.inArray(code, ignore) !== -1 );

      }
    })

    // store keyCode from keydown event for later use
    .live('keydown', function(event) {
      $.data(this, 'keycode', event.keyCode || event.which);
    });

});
</pre>
<p>See <a href="http://yelotofu.com/labs/jquery/snippets/textarea/">live example.</a></p>
<p>This code could probably be enhanced further by triggering custom events when the maximum length is reached or include a character counter of some sort within the keypress handler. Your imagination is the limit!</p>

<p><a href="http://feedads.g.doubleclick.net/~a/l7yCR1xJlvQeAwfXJs3GgV6_9MA/0/da"><img src="http://feedads.g.doubleclick.net/~a/l7yCR1xJlvQeAwfXJs3GgV6_9MA/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/l7yCR1xJlvQeAwfXJs3GgV6_9MA/1/da"><img src="http://feedads.g.doubleclick.net/~a/l7yCR1xJlvQeAwfXJs3GgV6_9MA/1/di" border="0" ismap="true"></img></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.yelotofu.com/2009/12/jquery-textarea-max-length/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
	</channel>
</rss><!-- WP Super Cache is installed but broken. The path to wp-cache-phase1.php in wp-content/advanced-cache.php must be fixed! -->

