<?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>eggBlog &#187; jQuery</title>
	<atom:link href="http://www.eggchops.com/category/web-stuff/jquery/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.eggchops.com</link>
	<description>The noble ramblings of an eggChop</description>
	<lastBuildDate>Mon, 12 Jul 2010 13:07:46 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.3</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>jGrowl &#8211; jQuery alerts and message box</title>
		<link>http://www.eggchops.com/web-stuff/jquery/jgrowl-jquery-alerts-and-message-box/</link>
		<comments>http://www.eggchops.com/web-stuff/jquery/jgrowl-jquery-alerts-and-message-box/#comments</comments>
		<pubDate>Mon, 27 Apr 2009 18:55:05 +0000</pubDate>
		<dc:creator>eggChops</dc:creator>
				<category><![CDATA[jQuery]]></category>
		<category><![CDATA[Javascript]]></category>

		<guid isPermaLink="false">http://www.eggchops.com/?p=251</guid>
		<description><![CDATA[jGrowl is a nifty little jQuery library that creates unobtrusive messages in the browser. It works in a similar way to Growl on Mac OS X.
It enables you to create great looking notifications from your website without it getting in the way. There are different styled examples including the iPhone notifications design. You can set [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://stanlemon.net/projects/jgrowl.html" target="_blank">jGrowl</a> is a nifty little jQuery library that creates unobtrusive messages in the browser. It works in a similar way to <a href="http://growl.info/" target="_blank">Growl</a> on Mac OS X.<br />
It enables you to create great looking notifications from your website without it getting in the way. There are different styled examples including the iPhone notifications design. You can set the time delay on the notification staying on the screen or if you want it to stay. The position of the notification can also be set and an animation when loading in the notification.</p>
<h3>How to initiate jGrowl</h3>
<p>Starting using jGrowl is pretty straight forward, simply include the js files and then call jGrowl as you would any jQuery class you have plugged in. The most simple example of how to do this is:</p>
<pre class="code">$.jGrowl("Hello world!");</pre>
<h3>Further resources</h3>
<p>More comprehensive information on how to use and extend jGrowl can be found at Stan Lemon&#8217;s project site (<a href="http://stanlemon.net/projects/jgrowl.html" target="_blank">http://stanlemon.net/projects/jgrowl.html</a>).</p>
<ul>
<li><a href="http://plugins.jquery.com/files/jgrowl-1.1.2.tar.gz">Download jGrowl 1.1.2</a></li>
<li><a href="http://plugins.jquery.com/project/jgrowl">jGrowl&#8217;s jQuery Plugin Page</a></li>
<li><a href="http://stanlemon.net/projects/jgrowl.html#samples">Example Usage and Samples</a></li>
</ul>
<h3>jGrowl Options:</h3>
<p>I have included the options for use with jGrowl below, but these can also be found on the plugin site.</p>
<table border="0" cellspacing="0" cellpadding="3" summary="">
<tbody>
<tr>
<th>Option Name:</th>
<th>Default Value:</th>
<th>Explanation:</th>
</tr>
<tr>
<td>header</td>
<td><em>empty string</em></td>
<td>Optional header to prefix the message, this is often helpful for associating messages to each other.</td>
</tr>
<tr>
<td>sticky</td>
<td>false</td>
<td>When set to true a message will <em>stick</em> to the screen until it is intentionally closed by the user.</td>
</tr>
<tr>
<td>glue</td>
<td>after</td>
<td>Designates whether a jGrowl notification should be appended to the container after all notifications, or whether it should be prepended to the container before all notifications. Options are <em>after</em> or <em>before</em>.</td>
</tr>
<tr>
<td>position</td>
<td>top-right</td>
<td>Designates a class which is applied to the jGrowl container and controls it&#8217;s position on the screen. By Default there are five options available, <em>top-left, top-right, bottom-left, bottom-right, center</em>. This must be changed in the defaults before the startup method is called.</td>
</tr>
<tr>
<td>theme</td>
<td>default</td>
<td>A CSS class designating custom styling for this particular message.</td>
</tr>
<tr>
<td>corners</td>
<td>10px</td>
<td>If the corners jQuery plugin is include this option specifies the curvature radius to be used for the notifications as they are created.</td>
</tr>
<tr>
<td>check</td>
<td>1000</td>
<td>The frequency that jGrowl should check for messages to be scrubbed from the screen.</td>
</tr>
<tr>
<td>life</td>
<td>3000</td>
<td>The lifespan of a non-sticky message on the screen.</td>
</tr>
<tr>
<td>speed</td>
<td>normal</td>
<td>The animation speed used to open or close a notification.</td>
</tr>
<tr>
<td>easing</td>
<td>swing</td>
<td>The easing method to be used with the animation for opening and closing a notification.</td>
</tr>
<tr>
<td>closer</td>
<td>true</td>
<td>Whether or not the close-all button should be used when more then one notification appears on the screen. Optionally this property can be set to a function which will be used as a callback when the close all button is clicked.</td>
</tr>
<tr>
<td>closeTemplate</td>
<td>&amp;times;</td>
<td>This content is used for the individual notification close links that are added to the corner of a notification.</td>
</tr>
<tr>
<td>closerTemplate</td>
<td>&lt;div&gt;[ close all ]&lt;/div&gt;</td>
<td>This content is used for the close-all link that is added to the bottom of a jGrowl container when it contains more than one notification.</td>
</tr>
<tr>
<td>log</td>
<td>function(e,m,o) {}</td>
<td>Callback to be used before anything is done with the notification. This is intended to be used if the user would like to have some type of logging mechanism for all notifications passed to jGrowl. This callback receives the notification&#8217;s DOM context, the notifications message and it&#8217;s option object.</td>
</tr>
<tr>
<td>beforeOpen</td>
<td>function(e,m,o) {}</td>
<td>Callback to be used before a new notification is opened. This callback receives the notification&#8217;s DOM context, the notifications message and it&#8217;s option object.</td>
</tr>
<tr>
<td>open</td>
<td>function(e,m,o) {}</td>
<td>Callback to be used when a new notification is opened. This callback receives the notification&#8217;s DOM context, the notifications message and it&#8217;s option object.</td>
</tr>
<tr>
<td>beforeClose</td>
<td>function(e,m,o) {}</td>
<td>Callback to be used before a new notification is closed. This callback receives the notification&#8217;s DOM context, the notifications message and it&#8217;s option object.</td>
</tr>
<tr>
<td>close</td>
<td>function(e,m,o) {}</td>
<td>Callback to be used when a new notification is closed. This callback receives the notification&#8217;s DOM context, the notifications message and it&#8217;s option object.</td>
</tr>
<tr>
<td>animateOpen</td>
<td>{ opacity: &#8217;show&#8217; }</td>
<td>The animation properties to use when opening a new notification (default to fadeOut).</td>
</tr>
<tr>
<td>animateClose</td>
<td>{ opacity: &#8216;hide&#8217; }</td>
<td>The animation properties to use when closing a new notification (defaults to fadeIn).</td>
</tr>
</tbody>
</table>
]]></content:encoded>
			<wfw:commentRss>http://www.eggchops.com/web-stuff/jquery/jgrowl-jquery-alerts-and-message-box/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>jQuery clear focus function</title>
		<link>http://www.eggchops.com/web-stuff/jquery/jquery-clear-focus-function/</link>
		<comments>http://www.eggchops.com/web-stuff/jquery/jquery-clear-focus-function/#comments</comments>
		<pubDate>Sat, 18 Apr 2009 11:51:33 +0000</pubDate>
		<dc:creator>eggChops</dc:creator>
				<category><![CDATA[jQuery]]></category>
		<category><![CDATA[Javascript]]></category>

		<guid isPermaLink="false">http://www.eggchops.com/?p=217</guid>
		<description><![CDATA[I had a problem on a site whereby the forms were designed so that the labels were essentially inside the text inputs. I found this looked nicer as it was less all over the place and the information of what needed to be entered in the field (e.g. email address) was easy to make out. [...]]]></description>
			<content:encoded><![CDATA[<p>I had a problem on a site whereby the forms were designed so that the labels were essentially inside the text inputs. I found this looked nicer as it was less all over the place and the information of what needed to be entered in the field (e.g. email address) was easy to make out. I made the form so that when you clicked in the field, it cleared out the input. The problem here is that you now don&#8217;t know what needs to go in there. You may have lost concentration for a second and come back to the room adn thought @Was that email address or first name that needed to be entered here?&#8217;</p>
<p>I came up with a solution to the problem so that when you click off the input, if you have not entered any information, it puts the label back in. Its quite simple, but a nice little touch for usability. Here is how to do it using  jQuery&#8230;</p>
<p>Theres the standard jQuery file to include and a couple of functions I wrote using jQuery. One for the focus event (when you click in the input) and one for the blur event (when you click away from the input). Basically it uses a title on the input that is the same as the value to begin with. This is saved in a variable and once the input is focussed on and then the input is cleared so you can type away.<br />
When you move away from the input, if nothing has been entered, it will replace it with the original value that was saved in the variable from the title. kind of like I have noticed a lot of forms on Facebook have started doing to clear and replenish unentered fields.</p>
<p>Below is the javascript code I use when doing this:</p>
<blockquote><p>&lt;script type=&#8221;text/javascript&#8221; src=&#8221;js/jquery.js&#8221;&gt;&lt;/script&gt;<br />
&lt;script type=&#8221;text/javascript&#8221;&gt;</p>
<p>$(document).ready(function(){</p>
<p>var clearMePrevious = &#8221;;</p>
<p>// clear input on focus<br />
$(&#8217;.clearMeFocus&#8217;).focus(function()<br />
{<br />
if($(this).val()==$(this).attr(&#8217;title&#8217;))<br />
{<br />
clearMePrevious = $(this).val();<br />
$(this).val(&#8221;);<br />
}<br />
});</p>
<p>// if field is empty afterward, add text again<br />
$(&#8217;.clearMeFocus&#8217;).blur(function()<br />
{<br />
if($(this).val()==&#8221;)<br />
{<br />
$(this).val(clearMePrevious);<br />
}<br />
});<br />
});</p>
<p>&lt;/script&gt;</p></blockquote>
<p>And here is the way I code the text inputs.</p>
<blockquote><p>&lt;input type=&#8221;text&#8221; name=&#8221;email&#8221; title=&#8221;Enter your email&#8221; value=&#8221;Enter your email&#8221; class=&#8221;clearMeFocus&#8221; /&gt;</p></blockquote>
<p>The class &#8216;clearMeFocus&#8217; is used so you know which fields on a form want to use this feature and also to grab the title and value from it. (I guess you don&#8217;t have to use that to get the info though&#8230;)</p>
<p>I have also put up an example of the jQuery functions and the form in action. It&#8217;s a simple form, but you get the idea&#8230;<a href="http://www.eggchops.com/blogexamples/jQueryClearFocus.html" target="_blank">it can be found here</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.eggchops.com/web-stuff/jquery/jquery-clear-focus-function/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>jQuery scroll to top animation (scrollTo plugin)</title>
		<link>http://www.eggchops.com/web-stuff/jquery/jquery-scroll-to-top-animation-scrollto-plugin/</link>
		<comments>http://www.eggchops.com/web-stuff/jquery/jquery-scroll-to-top-animation-scrollto-plugin/#comments</comments>
		<pubDate>Mon, 13 Apr 2009 16:57:46 +0000</pubDate>
		<dc:creator>eggChops</dc:creator>
				<category><![CDATA[jQuery]]></category>
		<category><![CDATA[Javascript]]></category>

		<guid isPermaLink="false">http://www.eggchops.com/?p=199</guid>
		<description><![CDATA[It&#8217;s the little things on sites that often make you want to return. I am a massive fan of sites that feel light and free. Where when you click on things, it does things you don&#8217;t always expect or aren&#8217;t programmed in your mind to accept will happen. Things where you think &#8220;That&#8217;s a nice [...]]]></description>
			<content:encoded><![CDATA[<p>It&#8217;s the little things on sites that often make you want to return. I am a massive fan of sites that feel light and free. Where when you click on things, it does things you don&#8217;t always expect or aren&#8217;t programmed in your mind to accept will happen. Things where you think &#8220;That&#8217;s a nice touch, why didn&#8217;t I think of that?&#8221;</p>
<p>So onto my point, here is a little touch that I often add to sites that I like to see happen. It&#8217;s simply having a &#8216;Back to top&#8217; button at the foot of the page that once clicked, scrolls you up with an animation rather that a page refresh or a straight jerk to the top again.<br />
Using the <a href="http://flesler.blogspot.com/2007/10/jqueryscrollto.html" target="_blank">jQuery scrollTo plugin</a>, you can achieve, what I see to be, a sweet scrolling animation.</p>
<h3>Implementing scrollTo to scroll to top using jQuery</h3>
<p>I&#8217;ll briefly outline the steps you will need to take to implement this, but more documentation and some better example can be found on the <a href="http://flesler.blogspot.com/2007/10/jqueryscrollto.html" target="_blank">plugin site</a>.</p>
<p>1. Download the <a href="http://flesler-plugins.googlecode.com/files/jquery.scrollTo-1.4.1-min.js" target="_blank">js file</a> that you will need and stick it in your site somewhere.<br />
2. Include the js file into the page you want it on.<br />
3. Initialise the function, so that when the link is clicked, it will perform the animation you want, with the speed you set and where you want it to scroll to. Then add the link you want to move you to the top.<br />
Here is an example of the code you might use to do this:</p>
<blockquote><p>&lt;<span class="start-tag">script</span><span class="attribute-name"> type</span>=<span class="attribute-value">&#8220;text/javascript&#8221; </span><span class="attribute-name">src</span>=<span class="attribute-value">&#8220;js/jquery.scrollTo.js&#8221;</span>&gt;&lt;/<span class="end-tag">script</span>&gt;<br />
&lt;<span class="start-tag">script</span><span class="attribute-name"> type</span>=<span class="attribute-value">&#8220;text/javascript&#8221;</span>&gt;<br />
$(document).ready(function()<br />
{<br />
// scroll to top<br />
$(&#8217;a.topOfPage&#8217;).click(function(){<br />
$.scrollTo( 0, 500);<br />
return false;<br />
});<br />
});<br />
&lt;/<span class="end-tag">script</span>&gt;</p>
<p>&lt;<span class="start-tag">a</span><span class="attribute-name"> href</span>=<span class="attribute-value">&#8220;#&#8221; </span><span class="attribute-name">class</span>=<span class="attribute-value">&#8220;topOfPage&#8221;</span>&gt;Top of page&lt;/<span class="end-tag">a</span>&gt;</p></blockquote>
<p>Here I have used jQuery to initialise the function when the a link with the class &#8216;topOfPage&#8217; is clicked.<br />
Once this is clicked, it uses the scrollTo plugin to go to the top of the page (as I have used 0 for the position) and with a speed of 500 milliseconds.</p>
<h3>Arguments accepted</h3>
<p>scrollTo accepts the following arguments:</p>
<blockquote><p>$.scrollTo( target, duration, settings );</p></blockquote>
<p><strong>Target </strong>can either be an element such as an id of an element (#elementName) or a class (.className) or simply the position on the page you want (&#8217;44&#8242;, &#8216;100px&#8217;, &#8216;+=30px&#8217;, etc).<br />
<strong>Duration </strong>is the length of time in milliseconds that you want it to take to reach the destination.<br />
<strong>Settings</strong> is basically a list of other parameters that you wish to pass to it, more information on these can be found <a href="http://flesler.blogspot.com/2007/10/jqueryscrollto.html" target="_blank">here</a>.</p>
<h3>Example using scrollTo</h3>
<p>An example of how I have implemented it in a site can be <a href="http://eggchops.com/scrollTo_example/" target="_blank">seen here</a>. Just scroll down to the bottom and click the &#8216;Top&#8217; link and it should scroll up nicely for you.</p>
<p>Like I said, it&#8217;s attention to detail like this on sites that I really like to see. You can take this how you like and use it to scroll up, down, across etc.<br />
I&#8217;m going to be putting a lot of that into the making of a personal project <a href="http://www.bethemiddleman.com" target="_blank">Betheiddleman.com</a>. Things like live validation, thickbox login boxes and more. So watch this space&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.eggchops.com/web-stuff/jquery/jquery-scroll-to-top-animation-scrollto-plugin/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>
