<?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>Ashley Ford - Tutorials :: jQuery :: PHP :: CSS :: HTML5 :: Papermashup.com &#187; jQuery</title>
	<atom:link href="http://papermashup.com/category/jquery/feed/" rel="self" type="application/rss+xml" />
	<link>http://papermashup.com</link>
	<description>Ashley Ford - Tutorials :: jQuery :: PHP :: CSS :: HTML5 :: Papermashup.com</description>
	<lastBuildDate>Thu, 03 May 2012 13:39:45 +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>Animate through a set of list items with jQuery</title>
		<link>http://papermashup.com/animate-through-a-set-of-list-items-with-jquery/</link>
		<comments>http://papermashup.com/animate-through-a-set-of-list-items-with-jquery/#comments</comments>
		<pubDate>Fri, 27 Jan 2012 11:29:10 +0000</pubDate>
		<dc:creator>Ashley</dc:creator>
				<category><![CDATA[Javascript]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[Learn]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[Web]]></category>

		<guid isPermaLink="false">http://papermashup.com/?p=2499</guid>
		<description><![CDATA[Here&#8217;s an interesting code snippet I&#8217;ve found handy in past projects. Great for highlighting specific information within an application or web page. To start with lets have a brief explanation as to what we&#8217;re going to be doing. We have &#8230; <br/> <a href="http://papermashup.com/animate-through-a-set-of-list-items-with-jquery/">Continue reading</a>]]></description>
			<content:encoded><![CDATA[<p>Here&#8217;s an interesting code snippet I&#8217;ve found handy in past projects. Great for highlighting specific information within an application or web page. To start with lets have a brief explanation as to what we&#8217;re going to be doing. We have a set of items in a list, and we want to iterate though the list increasing and decreasing the font size. Here&#8217;s how it&#8217;s done.</p>
<h3>The Code</h3>
<p>Firstly we setup three variables that are used in the function, notice that we&#8217;re chaining the variables instead of declaring &#8216;var&#8217; each time which is the optimal way of declaring multiple vars in jQuery. You can adjust the delay and animate values to suit your needs. We then loop through each list item using the eq(); method which allows us to select which list item to animate, you can see we&#8217;re passing the variable &#8216;i&#8217; to this method which is increased towards the bottom of the script. Within the loop we finally call the function again to start the process again.</p>
<pre class="brush: jscript; title: ;">

$(document).ready(function() {

         var i = 0,
         delay = 2000,
         animate = 400;
         function animateList(){
                 var imax = $(&quot;ul#list li&quot;).length -1;
                 $(&quot;ul#list li:eq(&quot; + i + &quot;)&quot;)
                         .animate({&quot;fontSize&quot; : &quot;80px&quot;}, animate)
                         .animate({&quot;fontSize&quot; : &quot;80px&quot;}, delay)
                         .animate({&quot;fontSize&quot; : &quot;30px&quot;}, animate, function(){

                                 (i == imax) ? i=0 : i++;
                                 animateList();
                         });

                 };

	   animateList();
});
</pre>
<h3>The HTML</h3>
<pre class="brush: xml; title: ;">

&lt;ul id=&quot;list&quot;&gt;
&lt;li&gt;Advertising&lt;/li&gt;
&lt;li&gt;Art&lt;/li&gt;
&lt;li&gt;Automotive&lt;/li&gt;
&lt;li&gt;Business&lt;/li&gt;
&lt;li&gt;Celebrity&lt;/li&gt;
&lt;/ul&gt; 
</pre>
<p><a href="http://papermashup.com/demos/jquery-list-animation/"><img src="http://papermashup.com/wp-content/uploads/2009/01/demo.png" alt="" title="demo" class="alignnone size-full wp-image-23" /></a><a href="http://papermashup.com/demos/jquery-list-animation/jquery-list-animation.zip"><img src="http://papermashup.com/wp-content/uploads/2009/01/download.png" alt="download" title="download" class="alignnone size-full wp-image-24" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://papermashup.com/animate-through-a-set-of-list-items-with-jquery/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>jQuery Fancy Switch</title>
		<link>http://papermashup.com/jquery-fancy-switch/</link>
		<comments>http://papermashup.com/jquery-fancy-switch/#comments</comments>
		<pubDate>Thu, 24 Nov 2011 23:24:39 +0000</pubDate>
		<dc:creator>Ashley</dc:creator>
				<category><![CDATA[Design]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[Learn]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[Downloads]]></category>

		<guid isPermaLink="false">http://papermashup.com/?p=2489</guid>
		<description><![CDATA[I wrote a post a while back on coding an iPhone style switch using jQuery. I&#8217;ve now put together a simple tutorial demonstrating how simple it is to build a switch that triggers two radio buttons in a field set. &#8230; <br/> <a href="http://papermashup.com/jquery-fancy-switch/">Continue reading</a>]]></description>
			<content:encoded><![CDATA[<p>I wrote a post a while back on coding an <a href="http://papermashup.com/jquery-iphone-style-ajax-switch/" target="_blank">iPhone style switch</a> using jQuery. I&#8217;ve now put together a simple tutorial demonstrating how simple it is to build a switch that triggers two radio buttons in a field set. It also degrades gracefully if JavaScript is disabled just displaying the two radio buttons with labels. This tutorial is aimed at users just stepping on the jQuery ladder, and hopefully this will demonstrate how simple some techniques are. The design of the switch was done by <a href="http://dribbble.com/shots/166165-Web-Elements" target="_blank">Shegy</a> and you can download the full set of switch designs as a PSD <a href="http://www.psdchest.com/2011/05/09/web-elements/" target="_blank">here</a></p>
<h3>The Code</h3>
<p>Lets run through line by line the JavaScript. The first three lines after the DOM ready function are setup incase the user has JavaScript disabled. So if enabled we display the switch background image and hide the radio buttons as well as indent the text on the labels.</p>
<p>We&#8217;ve then setup a &#8216;change()&#8217; function which means the function is executed each time the user selects either checkbox, we then check the value of the radio button thats been selected and adjust the background position of the sprite image.</p>
<p>Lastly for demo purposes im just displaying the status of the radio buttons in the div with the class &#8216;result&#8217;</p>
<pre class="brush: jscript; title: ;">

$(document).ready(function(){

	$('.switch').css('background', 'url(&quot;switch.png&quot;)');
	$('.on_off').css('display','none');
	$('.on, .off').css('text-indent','-10000px');

    $(&quot;input[name=on_off]&quot;).change(function() {
      var button = $(this).val();

		if(button == 'off'){ $('.switch').css('background-position', 'right'); }
		if(button == 'on'){ $('.switch').css('background-position', 'left'); }	 

		 $('.result span').html(button);
		 $('.result').fadeIn();

   });

});
</pre>
<h3>The HTML</h3>
<p>Here we have a simple form with the two radio buttons in a fieldset.</p>
<pre class="brush: xml; title: ;">

&lt;form action=&quot;&quot; method=&quot;get&quot;&gt;

&lt;fieldset class=&quot;switch&quot;&gt;
    &lt;label class=&quot;off&quot;&gt;Off&lt;input type=&quot;radio&quot; class=&quot;on_off&quot; name=&quot;on_off&quot; value=&quot;off&quot;/&gt;&lt;/label&gt;
    &lt;label class=&quot;on&quot;&gt;On&lt;input type=&quot;radio&quot; class=&quot;on_off&quot; name=&quot;on_off&quot; value=&quot;on&quot;/&gt;&lt;/label&gt;
&lt;/fieldset&gt;

&lt;input type=&quot;submit&quot; value=&quot;Submit&quot;/&gt;

&lt;/form&gt;

&lt;div class=&quot;result&quot;&gt;The button is: &lt;span&gt;on&lt;/span&gt;&lt;/div&gt;
</pre>
<h3>The CSS</h3>
<pre class="brush: css; title: ;">

#container{background:#ebebeb;}

.switch{
	border:none;
	background:left no-repeat;
	width:105px;
	height:46px;
	padding:0;
	margin:0;
}

.on, .off{
	width:50px;
	height:40px;
	display:inline-block;
	cursor:pointer;
}

.result{display:none;}
</pre>
<p><a href="http://papermashup.com/demos/jquery-switch/"><img src="http://papermashup.com/wp-content/uploads/2009/01/demo.png" alt="" title="demo" class="alignnone size-full wp-image-23" /></a><a href="http://papermashup.com/demos/jquery-switch/jquery-switch.zip"><img src="http://papermashup.com/wp-content/uploads/2009/01/download.png" alt="download" title="download" class="alignnone size-full wp-image-24" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://papermashup.com/jquery-fancy-switch/feed/</wfw:commentRss>
		<slash:comments>16</slash:comments>
		</item>
		<item>
		<title>jQuery Show / Hide Plugin</title>
		<link>http://papermashup.com/jquery-show-hide-plugin/</link>
		<comments>http://papermashup.com/jquery-show-hide-plugin/#comments</comments>
		<pubDate>Wed, 28 Sep 2011 17:28:06 +0000</pubDate>
		<dc:creator>Ashley</dc:creator>
				<category><![CDATA[Downloads]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[popular]]></category>
		<category><![CDATA[Tutorials]]></category>

		<guid isPermaLink="false">http://papermashup.com/?p=2451</guid>
		<description><![CDATA[Due to popular demand here&#8217;s a re-written version of the tutorial I wrote over a year ago on how to show and hide content using jQuery. After I first published the post I&#8217;ve had a lot of requests as to &#8230; <br/> <a href="http://papermashup.com/jquery-show-hide-plugin/">Continue reading</a>]]></description>
			<content:encoded><![CDATA[<p>Due to popular demand here&#8217;s a re-written version of the tutorial I wrote over a year ago on how to show and hide content using jQuery. After I first published the post I&#8217;ve had a lot of requests as to how you can show and hide multiple divs so I&#8217;ve written this plugin which does all the work for you!</p>
<h3>The Plugin</h3>
<pre class="brush: jscript; title: ;">
(function ($) {
    $.fn.showHide = function (options) {

	//default vars for the plugin
        var defaults = {
            speed: 1000,
			easing: '',
			changeText: 0,
			showText: 'Show',
			hideText: 'Hide'

        };
        var options = $.extend(defaults, options);

        $(this).click(function () {
// optionally add the class .toggleDiv to each div you want to automatically close
                      $('.toggleDiv').slideUp(options.speed, options.easing);
			 // this var stores which button you've clicked
             var toggleClick = $(this);
		     // this reads the rel attribute of the button to determine which div id to toggle
		     var toggleDiv = $(this).attr('rel');
		     // here we toggle show/hide the correct div at the right speed and using which easing effect
		     $(toggleDiv).slideToggle(options.speed, options.easing, function() {
		     // this only fires once the animation is completed
			 if(options.changeText==1){
		     $(toggleDiv).is(&quot;:visible&quot;) ? toggleClick.text(options.hideText) : toggleClick.text(options.showText);
			 }
              });

		  return false;

        });

    };
})(jQuery);
</pre>
<h3>The Usage</h3>
<p>Here we setup the options for the plugin. you can set the speed of the toggle, if you include the jQuery UI plugin you can specify an easing effect. Also there&#8217;s an option to change the text for the button. 1 is change 0 is dont change. and the final options are the show and hide text.</p>
<pre class="brush: jscript; title: ;">

$(document).ready(function(){

   $('.show_hide').showHide({
		speed: 1000,  // speed you want the toggle to happen
		easing: '',  // the animation effect you want. Remove this line if you dont want an effect and if you haven't included jQuery UI
		changeText: 1, // if you dont want the button text to change, set this to 0
		showText: 'View',// the button text to show when a div is closed
		hideText: 'Close' // the button text to show when a div is open

	});

});
</pre>
<h3>The HTML</h3>
<p>Here you can see the simple usage for the plugin. We&#8217;ve already set the plugin options above in our DOM ready function now here we set our divs up. for element you want to toggle, you just need to add the div id to the rel attribute of the a tag as shown below. You can now add as many show hide divs as you want to.</p>
<blockquote><p>If you want all the open divs to close when you click to open another simply add the class .toggleDiv to each element.</p></blockquote>
<pre class="brush: xml; title: ;">
 &lt;a class=&quot;show_hide&quot; href=&quot;#&quot; rel=&quot;#slidingDiv&quot;&gt;View&lt;/a&gt;&lt;/pre&gt;
&lt;div id=&quot;slidingDiv&quot; class=&quot;toggleDiv&quot; style=&quot;display: none;&quot;&gt;Fill this space with really interesting content.&lt;/div&gt;
&lt;pre&gt;
 &lt;a class=&quot;show_hide&quot; href=&quot;#&quot; rel=&quot;#slidingDiv_2&quot;&gt;View&lt;/a&gt;&lt;/pre&gt;
&lt;div id=&quot;slidingDiv_2&quot; class=&quot;toggleDiv&quot; style=&quot;display: none;&quot;&gt;Fill this space with really interesting content.&lt;/div&gt;
&lt;pre&gt;
</pre>
<p><a href="http://papermashup.com/demos/jquery-show-hide-plugin/"><img class="alignnone size-full wp-image-23" title="demo" src="http://papermashup.com/wp-content/uploads/2009/01/demo.png" alt="" /></a> <a href="http://papermashup.com/demos/jquery-show-hide-plugin/jquery-show-hide-plugin.zip"><img class="alignnone size-full wp-image-24" title="download" src="http://papermashup.com/wp-content/uploads/2009/01/download.png" alt="download" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://papermashup.com/jquery-show-hide-plugin/feed/</wfw:commentRss>
		<slash:comments>113</slash:comments>
		</item>
		<item>
		<title>Build a simple animated progress bar with tooltip</title>
		<link>http://papermashup.com/build-a-simple-animated-progress-bar-with-tooltip/</link>
		<comments>http://papermashup.com/build-a-simple-animated-progress-bar-with-tooltip/#comments</comments>
		<pubDate>Sun, 14 Aug 2011 21:47:37 +0000</pubDate>
		<dc:creator>Ashley</dc:creator>
				<category><![CDATA[Design]]></category>
		<category><![CDATA[Downloads]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[Learn]]></category>
		<category><![CDATA[Tutorials]]></category>

		<guid isPermaLink="false">http://papermashup.com/?p=2381</guid>
		<description><![CDATA[Here&#8217;s a very basic example of how to code up an animated progress bar with tooltip using the Tipsy tooltip plugin. First I started out in Photoshop and designed the basic progress bar, you can download the PSD file for &#8230; <br/> <a href="http://papermashup.com/build-a-simple-animated-progress-bar-with-tooltip/">Continue reading</a>]]></description>
			<content:encoded><![CDATA[<p>Here&#8217;s a very basic example of how to code up an animated progress bar with tooltip using the <a href="http://onehackoranother.com/projects/jquery/tipsy/" target="_blank">Tipsy tooltip plugin</a>. First I started out in Photoshop and designed the basic progress bar, you can download the PSD file for the progress bar in the download file.</p>
<p><img src="http://papermashup.com/wp-content/uploads/2011/08/progress_psd.jpg" alt="" title="progress_psd" width="583" height="320" class="alignnone size-full wp-image-2384" /></p>
<h3>The Code</h3>
<p>Below we have the two lines of code which read the attribute &#8216;title&#8217; and animate the progress bar. We then activate the tooltip plugin using the <a href="http://onehackoranother.com/projects/jquery/tipsy/" target="_blank">tipsy plugin</a>.</p>
<pre class="brush: jscript; title: ;">

$(&quot;document&quot;).ready(function (){ 

// animate the progress bar onload
var percent = $('.progress_bar').attr('title');
$('.progress_bar').animate({width: percent},1000);

// activate tooltip
	 $('.tip').tipsy({gravity: 's',fade: true});

});
</pre>
<h3>The HTML</h3>
<p>Very simple. Just one line of code with two div elements. Both the tooltip and the animation javascript read the &#8216;title&#8217; attribute.</p>
<pre class="brush: xml; title: ;">

&lt;div class=&quot;progress_container&quot;&gt;&lt;div class=&quot;progress_bar tip&quot; title=&quot;78%&quot;&gt;&lt;/div&gt;&lt;/div&gt;
</pre>
<h3>The CSS</h3>
<pre class="brush: css; title: ;">

body{
	padding:50px;
	font-size:11px;
	font-family:Arial, Helvetica, sans-serif;}

.progress_container{
	padding:1px;
	width:195px;
	height:9px;
	overflow:hidden;
	background:url(progress_container.png);
	}

.progress_bar{
	height:9px;
	width:0px;
	-moz-border-radius:5px;
	-webkit-border-radius:5px;
	border-radius:5px;
	background:url(progress_bar.png);
	}

/*-----------------------------------------------------------------------------------*/
/*Tipsy Tooltip style
/*-----------------------------------------------------------------------------------*/  

  .tipsy { padding: 5px; font-size: 11px; position: absolute; z-index: 100000; }
  .tipsy-inner { padding: 6px 8px 6px 8px; background-color: black; color: white; max-width: 200px; text-align: center; }
  .tipsy-inner { border-radius: 3px; -moz-border-radius:3px; -webkit-border-radius:3px; }
  .tipsy-arrow { position: absolute; background: url('tipsy.gif') no-repeat top left; width: 9px; height: 5px; }
  .tipsy-n .tipsy-arrow { top: 0; left: 50%; margin-left: -4px; }
  .tipsy-nw .tipsy-arrow { top: 0; left: 10px; }
  .tipsy-ne .tipsy-arrow { top: 0; right: 10px; }
  .tipsy-s .tipsy-arrow { bottom: 0; left: 50%; margin-left: -4px; background-position: bottom left; }
  .tipsy-sw .tipsy-arrow { bottom: 0; left: 10px; background-position: bottom left; }
  .tipsy-se .tipsy-arrow { bottom: 0; right: 10px; background-position: bottom left; }
  .tipsy-e .tipsy-arrow { top: 50%; margin-top: -4px; right: 0; width: 5px; height: 9px; background-position: top right; }
  .tipsy-w .tipsy-arrow { top: 50%; margin-top: -4px; left: 0; width: 5px; height: 9px; }	
</pre>
<h3>The result</h3>
<p><img src="http://papermashup.com/wp-content/uploads/2011/08/progress1.jpg" alt="" title="progress" width="583" height="209" class="alignnone size-full wp-image-2389" /></p>
<blockquote><p>It&#8217;s worth noting that this technique is only compatible with Firefox and Chrome browsers, and those that allow the border-radius  css class.</p></blockquote>
<p><a href="http://papermashup.com/demos/jquery-progress-bar/"><img src="http://papermashup.com/wp-content/uploads/2009/01/demo.png" alt="" title="demo" class="alignnone size-full wp-image-23" /></a> <a href="http://papermashup.com/demos/jquery-progress-bar/jquery-progress-bar.zip"><img src="http://papermashup.com/wp-content/uploads/2009/01/download.png" alt="download" title="download" class="alignnone size-full wp-image-24" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://papermashup.com/build-a-simple-animated-progress-bar-with-tooltip/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>jQuery UI Slider</title>
		<link>http://papermashup.com/jquery-ui-slider/</link>
		<comments>http://papermashup.com/jquery-ui-slider/#comments</comments>
		<pubDate>Thu, 19 May 2011 17:03:56 +0000</pubDate>
		<dc:creator>Ashley</dc:creator>
				<category><![CDATA[Design]]></category>
		<category><![CDATA[Downloads]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[Learn]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[Web Tools]]></category>
		<category><![CDATA[Web]]></category>

		<guid isPermaLink="false">http://papermashup.com/?p=2309</guid>
		<description><![CDATA[I&#8217;ve been hugely inspired recently by the design work of Orman Clark from Premiumpixels.com and his generous selection of top quality PSD downloads. after seeing this beautiful design of a button and slider set I was eager to code up &#8230; <br/> <a href="http://papermashup.com/jquery-ui-slider/">Continue reading</a>]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been hugely inspired recently by the design work of <a href="http://twitter.com/ormanclark">Orman Clark</a> from <a href="http://premiumpixels.com">Premiumpixels.com</a> and his generous selection of top quality PSD downloads. after seeing this beautiful <a href="http://www.premiumpixels.com/freebies/slider-interface-metal-handle-psd/">design of a button and slider</a> set I was eager to code up a working version using jQuery UI. You can grab the <a href="http://www.premiumpixels.com/freebies/slider-interface-metal-handle-psd/">PSD for the design here</a> along with tons of awesome resources.</p>
<h3>The Code</h3>
<p>Most of the code is CSS for this one so lets start here</p>
<pre class="brush: css; title: ;">

body{
background:url(bg.jpg)!important;
padding:100px 50px 0px 50px;
}

/*the slider background*/
.slider {
width:230px;
height:11px;
background:url(slider-bg.png);
position:relative;
margin:0;
padding:0 10px;
}

/*Style for the slider button*/
.ui-slider-handle {
width:24px;
height:24px;
position:absolute;
top:-7px;
margin-left:-12px;
z-index:200;
background:url(slider-button.png);
}

/*Result div where the slider value is displayed*/
#slider-result {
font-size:50px;
height:200px;
font-family:Arial, Helvetica, sans-serif;
color:#fff;
width:250px;
text-align:center;
text-shadow:0 1px 1px #000;
font-weight:700;
padding:20px 0;
}

/*This is the fill bar colour*/
.ui-widget-header {
background:url(fill.png) no-repeat left;
height:8px;
left:1px;
top:1px;
position:absolute;
}

a {
outline:none;
-moz-outline-style:none;
}
</pre>
<h3>The JavaScript</h3>
<p>Using jQuery UI is pretty painless. It&#8217;s very easy to setup you simply add a holder div for your slider, in this case we&#8217;re specifying the div with the class &#8216;.slider&#8217; we then call the slider() method passing the in some values.</p>
<pre class="brush: jscript; title: ;">
 $( &quot;.slider&quot; ).slider({
	        animate: true,
                range: &quot;min&quot;,
                value: 50,
                min: 10,
                max: 100,
				step: 10,

				//this gets a live reading of the value and prints it on the page
                slide: function( event, ui ) {
                    $( &quot;#slider-result&quot; ).html( ui.value );
                },

				//this updates the hidden form field so we can submit the data using a form
                change: function(event, ui) {
                $('#hidden').attr('value', ui.value);
                }

				});
</pre>
<h3>The HTML</h3>
<p>Pretty simple snippet of HTML&#8230;</p>
<pre class="brush: xml; title: ;">
       &lt;div class=&quot;slider&quot;&gt;&lt;/div&gt;
        &lt;div id=&quot;slider-result&quot;&gt;50&lt;/div&gt;
  	&lt;input type=&quot;hidden&quot; id=&quot;hidden&quot;/&gt;
</pre>
<p><a href="http://papermashup.com/demos/jquery-slider-bar/"><img src="http://papermashup.com/wp-content/uploads/2009/01/demo.png" alt="" title="demo" class="alignnone size-full wp-image-23" /></a><a href="http://papermashup.com/demos/jquery-slider-bar/jquery-slider-bar.zip"><img src="http://papermashup.com/wp-content/uploads/2009/01/download.png" alt="download" title="download" class="alignnone size-full wp-image-24" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://papermashup.com/jquery-ui-slider/feed/</wfw:commentRss>
		<slash:comments>12</slash:comments>
		</item>
		<item>
		<title>Dynamically updating times using jQuery</title>
		<link>http://papermashup.com/dynamically-updating-times-using-jquery/</link>
		<comments>http://papermashup.com/dynamically-updating-times-using-jquery/#comments</comments>
		<pubDate>Mon, 14 Mar 2011 18:06:30 +0000</pubDate>
		<dc:creator>Ashley</dc:creator>
				<category><![CDATA[Javascript]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[Plugin]]></category>
		<category><![CDATA[Timeago]]></category>

		<guid isPermaLink="false">http://papermashup.com/?p=2227</guid>
		<description><![CDATA[With the rise of Facebook and Twitter we&#8217;re so used to instantly updating data and being able to judge fresh content almost instantly. Facebook for instance automatically updates how long ago someone left a comment on the fly without even &#8230; <br/> <a href="http://papermashup.com/dynamically-updating-times-using-jquery/">Continue reading</a>]]></description>
			<content:encoded><![CDATA[<p>With the rise of Facebook and Twitter we&#8217;re so used to instantly updating data and being able to judge fresh content almost instantly. Facebook for instance automatically updates how long ago someone left a comment on the fly without even refreshing the page. There&#8217;s an easy frontend solution to generating this. and here are the advantages and disadvantages.</p>
<h3>Advantages</h3>
<ul>
<li>- Generating the same server side puts the strain on your server, using JavaScript means everything is handled client side</li>
<li>- JavaScript allows for the time to be updated every minute, this wouldn&#8217;t be possible using server side technology</li>
<li>- A lightweight jQuery plugin as opposed to a large PHP function</li>
</ul>
<p><br/></p>
<h3>Disadvantages</h3>
<ul>
<li>- If you have JavaScript disabled you see a date dependent on how you&#8217;ve formatted it</li>
</ul>
<p><br/></p>
<h3>The Code</h3>
<p>first you need to include the <a href="http://github.com/rmm5t/jquery-timeago">Timeago jQuery plugin</a> and helper.js file. Then you simply call the function below and specify the class that your timestamp is.</p>
<pre class="brush: jscript; title: ;">
 $(document).ready(function($) {
        prepareDynamicDates();
        $(&quot;.time&quot;).timeago();

      });
</pre>
<h3>The HTML</h3>
<pre class="brush: xml; title: ;">
    &lt;div id=&quot;content&quot;&gt; 

      &lt;p&gt;
        You opened this page &lt;abbr class=&quot;loaded time&quot;&gt;a moment ago&lt;/abbr&gt;. &lt;span class=&quot;help&quot;&gt;(This will update every minute. Wait for it.)&lt;/span&gt;
      &lt;/p&gt;
      &lt;p&gt;
        The 20th of June was &lt;abbr class=&quot;time&quot; title=&quot;2010-06-20 12:23:04&quot;&gt;20th June 2010&lt;/abbr&gt;.
      &lt;/p&gt; 

    &lt;/div&gt;
</pre>
<p><a href="http://papermashup.com/demos/dynamic-dates/"><img src="http://papermashup.com/wp-content/uploads/2009/01/demo.png" alt="" title="demo" class="alignnone size-full wp-image-23" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://papermashup.com/dynamically-updating-times-using-jquery/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>jQuery list filtering</title>
		<link>http://papermashup.com/jquery-list-filtering/</link>
		<comments>http://papermashup.com/jquery-list-filtering/#comments</comments>
		<pubDate>Mon, 24 Jan 2011 07:00:06 +0000</pubDate>
		<dc:creator>Ashley</dc:creator>
				<category><![CDATA[Javascript]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[Downloads]]></category>

		<guid isPermaLink="false">http://papermashup.com/?p=2214</guid>
		<description><![CDATA[Here&#8217;s a clever little script that&#8217;s certainly useful if you want to give users the functionality to refine search results or filter product results. If you had a list of films with long titles this would be a quick and &#8230; <br/> <a href="http://papermashup.com/jquery-list-filtering/">Continue reading</a>]]></description>
			<content:encoded><![CDATA[<p>Here&#8217;s a clever little script that&#8217;s certainly useful if you want to give users the functionality to refine search results or filter product results. If you had a list of films with long titles this would be a quick and easy way to filter through the results.</p>
<h3>The Code</h3>
<p>The code below works by searching the text in the list items on each key press. It then filters the results by sliding out the items that don&#8217;t match. </p>
<pre class="brush: jscript; title: ;">

(function ($) {
  jQuery.expr[':'].Contains = function(a,i,m){
      return (a.textContent || a.innerText || &quot;&quot;).toUpperCase().indexOf(m[3].toUpperCase())&gt;=0;
  };

  function filterList(header, list) {
    var form = $(&quot;&lt;form&gt;&quot;).attr({&quot;class&quot;:&quot;filterform&quot;,&quot;action&quot;:&quot;#&quot;}),
        input = $(&quot;&lt;input&gt;&quot;).attr({&quot;class&quot;:&quot;filterinput&quot;,&quot;type&quot;:&quot;text&quot;});
    $(form).append(input).appendTo(header);

    $(input)
      .change( function () {
        var filter = $(this).val();
        if(filter) {

		  $matches = $(list).find('a:Contains(' + filter + ')').parent();
		  $('li', list).not($matches).slideUp();
		  $matches.slideDown();

        } else {
          $(list).find(&quot;li&quot;).slideDown();
        }
        return false;
      })
    .keyup( function () {
        $(this).change();
    });
  }

  $(function () {
    filterList($(&quot;#form&quot;), $(&quot;#list&quot;));
  });
}(jQuery));
</pre>
<h3>The HTML</h3>
<pre class="brush: jscript; title: ;">
&lt;div id=&quot;wrap&quot;&gt;
&lt;div class=&quot;product-head&quot;&gt;
  &lt;h1&gt;Product Search&lt;/h1&gt;
    &lt;div id=&quot;form&quot;&gt;&lt;/div&gt;
    &lt;div class=&quot;clear&quot;&gt;&lt;/div&gt;
&lt;/div&gt;
  &lt;ul id=&quot;list&quot;&gt;
		&lt;li&gt;&lt;img src=&quot;products/apple.png&quot; width=&quot;30&quot; height=&quot;30&quot; align=&quot;absmiddle&quot;/&gt; &lt;a href=&quot;#/Apple/&quot;&gt;Apple&lt;/a&gt;&lt;/li&gt;
		&lt;li&gt;&lt;img src=&quot;products/acorn_squash.png&quot; width=&quot;30&quot; height=&quot;30&quot; align=&quot;absmiddle&quot;/&gt; &lt;a href=&quot;#/Squash/&quot;&gt;Acorn Squash&lt;/a&gt;&lt;/li&gt;
		&lt;li&gt;&lt;img src=&quot;products/broccoli.png&quot; width=&quot;30&quot; height=&quot;30&quot; align=&quot;absmiddle&quot;/&gt; &lt;a href=&quot;#/Broccoli/&quot;&gt;Broccoli&lt;/a&gt;&lt;/li&gt;
		&lt;li&gt;&lt;img src=&quot;products/carrot.png&quot; width=&quot;30&quot; height=&quot;30&quot; align=&quot;absmiddle&quot;/&gt; &lt;a href=&quot;#/Carrot/&quot;&gt;Carrot&lt;/a&gt;&lt;/li&gt;
		&lt;li&gt;&lt;img src=&quot;products/celery.png&quot; width=&quot;30&quot; height=&quot;30&quot; align=&quot;absmiddle&quot;/&gt; &lt;a href=&quot;#/Celery/&quot;&gt;Celery&lt;/a&gt;&lt;/li&gt;
		&lt;li&gt;&lt;img src=&quot;products/lettuce.png&quot; width=&quot;30&quot; height=&quot;30&quot; align=&quot;absmiddle&quot;/&gt; &lt;a href=&quot;#/Lettuce/&quot;&gt;Lettuce&lt;/a&gt;&lt;/li&gt;
		&lt;li&gt;&lt;img src=&quot;products/mushroom.png&quot; width=&quot;30&quot; height=&quot;30&quot; align=&quot;absmiddle&quot;/&gt; &lt;a href=&quot;#/Mushroom/&quot;&gt;Mushroom&lt;/a&gt;&lt;/li&gt;
		&lt;li&gt;&lt;img src=&quot;products/onion.png&quot; width=&quot;30&quot; height=&quot;30&quot; align=&quot;absmiddle&quot;/&gt; &lt;a href=&quot;#/Onion/&quot;&gt;Onion&lt;/a&gt;&lt;/li&gt;
		&lt;li&gt;&lt;img src=&quot;products/potato.png&quot; width=&quot;30&quot; height=&quot;30&quot; align=&quot;absmiddle&quot;/&gt; &lt;a href=&quot;#/Potato/&quot;&gt;Potato&lt;/a&gt;&lt;/li&gt;
		&lt;li&gt;&lt;img src=&quot;products/pumpkin.png&quot; width=&quot;30&quot; height=&quot;30&quot; align=&quot;absmiddle&quot;/&gt; &lt;a href=&quot;#/Pumpkin/&quot;&gt;Pumpkin&lt;/a&gt;&lt;/li&gt;
		&lt;li&gt;&lt;img src=&quot;products/radish.png&quot; width=&quot;30&quot; height=&quot;30&quot; align=&quot;absmiddle&quot;/&gt; &lt;a href=&quot;#/Radish/&quot;&gt;Radish&lt;/a&gt;&lt;/li&gt;
	    &lt;li&gt;&lt;img src=&quot;products/squash.png&quot; width=&quot;30&quot; height=&quot;30&quot; align=&quot;absmiddle&quot;/&gt; &lt;a href=&quot;#/Squash/&quot;&gt;Squash&lt;/a&gt;&lt;/li&gt;
    	&lt;li&gt;&lt;img src=&quot;products/strawberry.png&quot; width=&quot;30&quot; height=&quot;30&quot; align=&quot;absmiddle&quot;/&gt; &lt;a href=&quot;#/strawberry/&quot;&gt;Strawberry&lt;/a&gt;&lt;/li&gt;
        &lt;li&gt;&lt;img src=&quot;products/sugar_snap.png&quot; width=&quot;30&quot; height=&quot;30&quot; align=&quot;absmiddle&quot;/&gt; &lt;a href=&quot;#/SugarSnaps/&quot;&gt;Sugar Snaps&lt;/a&gt;&lt;/li&gt;
        &lt;li&gt;&lt;img src=&quot;products/tomato.png&quot; width=&quot;30&quot; height=&quot;30&quot; align=&quot;absmiddle&quot;/&gt; &lt;a href=&quot;#/tomato/&quot;&gt;Tomato&lt;/a&gt;&lt;/li&gt;
	&lt;/ul&gt;
&lt;/div&gt;
</pre>
<p><a href="http://papermashup.com/demos/jquery-list-filter/"><img src="http://papermashup.com/wp-content/uploads/2009/01/demo.png" alt="" title="demo" class="alignnone size-full wp-image-23" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://papermashup.com/jquery-list-filtering/feed/</wfw:commentRss>
		<slash:comments>13</slash:comments>
		</item>
		<item>
		<title>Automatically pull in user Gravatar images</title>
		<link>http://papermashup.com/automatically-pull-in-user-gravatar-images/</link>
		<comments>http://papermashup.com/automatically-pull-in-user-gravatar-images/#comments</comments>
		<pubDate>Thu, 20 Jan 2011 17:30:32 +0000</pubDate>
		<dc:creator>Ashley</dc:creator>
				<category><![CDATA[Design]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[Web Tools]]></category>
		<category><![CDATA[Wordpress]]></category>
		<category><![CDATA[Downloads]]></category>
		<category><![CDATA[tools]]></category>

		<guid isPermaLink="false">http://papermashup.com/?p=2191</guid>
		<description><![CDATA[I was browsing forrst.com and saw a pretty interesting code snippet from Chris Coyier from CSS-Tricks which is pretty useful for WordPress users and allows the gravatar of a commenter to be dynamically pulled into the comment box as soon &#8230; <br/> <a href="http://papermashup.com/automatically-pull-in-user-gravatar-images/">Continue reading</a>]]></description>
			<content:encoded><![CDATA[<p>I was browsing <a href="http://forrst.com">forrst.com</a> and saw a pretty interesting code snippet from Chris Coyier from <a href="http://css-tricks.com/">CSS-Tricks</a> which is pretty useful for WordPress users and allows the gravatar of a commenter to be dynamically pulled into the comment box as soon as the user has clicked out of the email input field.</p>
<h3>The Code</h3>
<p>This code snippet is pretty easy to grasp. We&#8217;re simple replacing the background image of the div #avatar each time the user clicks out of the email input field. you&#8217;ll notice that we&#8217;re also calling the function MD5(). This is because Gravatar uses your email address encoded into an MD5 hash as an id to pull your avatar. You also need to include the function MD5() which is available in the Download.</p>
<pre class="brush: jscript; title: ;">

$(document).ready(function(){

var email = $(&quot;#email&quot;),
avatar = $(&quot;#avatar&quot;);

email.blur(function() {
avatar.css(&quot;background-image&quot;,&quot;url(http://www.gravatar.com/avatar/&quot; + MD5(email.val()) + &quot;)&quot;);

});

});
</pre>
<h3>The HTML</h3>
<pre class="brush: xml; title: ;">
&lt;div id=&quot;avatar&quot;&gt;&lt;img src=&quot;thumb.png&quot; width=&quot;80&quot; height=&quot;80&quot;/&gt;&lt;/div&gt;

&lt;form class=&quot;gravatar&quot;&gt;
&lt;input type=&quot;text&quot; onFocus=&quot;if(this.value=='Email Address') this.value='';&quot; onBlur=&quot;if(this.value=='') this.value='Email Address';&quot; value=&quot;Email Address&quot; name=&quot;s&quot; id=&quot;email&quot; /&gt;
&lt;/form&gt;
</pre>
<p><a href="http://papermashup.com/demos/gravatar-image/"><img class="alignnone size-full wp-image-23" title="demo" src="http://papermashup.com/wp-content/uploads/2009/01/demo.png" alt="" /></a><a href="http://papermashup.com/demos/gravatar-image/gravatar-image.zip"><img src="http://papermashup.com/wp-content/uploads/2009/01/download.png" alt="download" title="download" class="alignnone size-full wp-image-24" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://papermashup.com/automatically-pull-in-user-gravatar-images/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>jQuery Face Detection</title>
		<link>http://papermashup.com/jquery-face-detection/</link>
		<comments>http://papermashup.com/jquery-face-detection/#comments</comments>
		<pubDate>Fri, 05 Nov 2010 12:56:43 +0000</pubDate>
		<dc:creator>Ashley</dc:creator>
				<category><![CDATA[Javascript]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[popular]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[Face Detection]]></category>

		<guid isPermaLink="false">http://papermashup.com/?p=2132</guid>
		<description><![CDATA[Jay Salvat just posted a brilliant plugin that automatically detects faces in a picture. You can download the code from Git Hub or check out the demo here The plugin is fairly easy to integrate into a social application, all &#8230; <br/> <a href="http://papermashup.com/jquery-face-detection/">Continue reading</a>]]></description>
			<content:encoded><![CDATA[<p>Jay Salvat just posted a brilliant plugin that automatically detects faces in a picture. You can <a href="https://github.com/jaysalvat/jquery.facedetection">download</a> the code from Git Hub or check out the <a href="http://papermashup.com/demos/jquery-facedetect/">demo here</a></p>
<p>The plugin is fairly easy to integrate into a social application, all you need to do is add the following code to a page so when you click the &#8216;detect faces&#8217; button the plugin is run.</p>
<p>you also need to include 3 javascript files. The algorithm for detecting faces was originally written by  <a href="https://github.com/liuliu/ccv">Liu Liu </a></p>
<pre class="brush: jscript; title: ;">

$(function() {
		$('#detect').click(function() {

			var coords = $('#demo img').faceDetection({
				start:function(img) {
					$('.face').remove();
					$('#detect').text('Processing...');
				},
				complete:function(img, coords) {
					$('#detect').fadeOut();
				},
				error:function(img, code, message) {
					alert('Error '+code+': '+message);
				}
			});

			for (var i = 0; i &lt; coords.length; i++) {
				$('&lt;div&gt;', {
					'class':'face',
					'css': {
						'position':	'absolute',
						'left':		coords[i].positionX	+'px',
						'top':		coords[i].positionY	+'px',
						'width': 	coords[i].width		+'px',
						'height': 	coords[i].height	+'px'
					}
				})
				.appendTo('#demo');
			}

			return false;
		});
	});
</pre>
<p><a href="http://papermashup.com/demos/jquery-facedetect/"><img src="http://papermashup.com/wp-content/uploads/2009/01/demo.png" alt="" title="demo" class="alignnone size-full wp-image-23" /></a><a href="https://github.com/jaysalvat/jquery.facedetection"><img src="http://papermashup.com/wp-content/uploads/2009/01/download.png" alt="download" title="download" class="alignnone size-full wp-image-24" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://papermashup.com/jquery-face-detection/feed/</wfw:commentRss>
		<slash:comments>13</slash:comments>
		</item>
		<item>
		<title>jQuery scalable fullscreen background image</title>
		<link>http://papermashup.com/jquery-scalable-fullscreen-background-image/</link>
		<comments>http://papermashup.com/jquery-scalable-fullscreen-background-image/#comments</comments>
		<pubDate>Wed, 20 Oct 2010 13:10:01 +0000</pubDate>
		<dc:creator>Ashley</dc:creator>
				<category><![CDATA[Javascript]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[Downloads]]></category>
		<category><![CDATA[Gallery]]></category>

		<guid isPermaLink="false">http://papermashup.com/?p=2123</guid>
		<description><![CDATA[I remember when fullscreen flash sites we&#8217;re all the rage in the mid 90&#8242;s with flamboyant splash pages enticing you in. A large number of these sites had an eye catching image that would full your browser regardless of the &#8230; <br/> <a href="http://papermashup.com/jquery-scalable-fullscreen-background-image/">Continue reading</a>]]></description>
			<content:encoded><![CDATA[<p>I remember when fullscreen flash sites we&#8217;re all the rage in the mid 90&#8242;s with flamboyant splash pages enticing you in. A large number of these sites had an eye catching image that would full your browser regardless of the window size. Here&#8217;s how to set an image as the background for a webpage and make it proportionally scale depending on what size your browser window is.</p>
<h3>The Code</h3>
<p>Firstly we need to add an image to the page and give the image tag the id &#8216;background-image&#8217; it&#8217;s recommended to add the image right after the opening &#8216;body&#8217; tag.</p>
<p>The JavaScript to calculate the client browser window and photo dimensions is relatively simple. the first block of code does some initial calculations to determine the image ratio, browser width etc.</p>
<p>Then using jQuery to manipulate the image CSS rules we can stretch the image to fit the browser but keep the image in proportion.  </p>
<pre class="brush: jscript; title: ;">

$(document).ready(function() {

 var bgImage = $('#background-image');		

    function resizeImg() {
      var imgwidth = bgImage.width(),
		   imgheight = bgImage.height(),
		   winwidth = $(window).width(),
		   winheight = $(window).height(),
		   widthratio = winwidth / imgwidth,
		   heightratio = winheight / imgheight,
		   widthdiff = heightratio * imgwidth,
		   heightdiff = widthratio * imgheight;

      if(heightdiff&gt;winheight) {
        bgImage.css({
          width: winwidth+'px',
          height: heightdiff+'px'
        });
      } else {
        bgImage.css({
          width: widthdiff+'px',
          height: winheight+'px'
        });
      }

	 $(&quot;#background-image&quot;).show();

    }
    resizeImg();
    $(window).resize(function() {
      resizeImg();
    }); 

});
</pre>
<h3>A sprinkle of CSS</h3>
<p>In order for the image to sit behind our page content we need to position it absolute with a lower z-index than the rest of our page content. You&#8217;ll also see that by default the image is set to display none, this is for users who dont have JavaScript enabled so they wont see the image at all.</p>
<pre class="brush: css; title: ;">

#background-image{
	position:absolute;
	top:0;
	left:0;
	z-index:-10;
	overflow: hidden;
    width: 100%;
	display:none;
	}
</pre>
<p><a href="http://papermashup.com/demos/jquery-fullscreen-image/"><img src="http://papermashup.com/wp-content/uploads/2009/01/demo.png" alt="" title="demo" class="alignnone size-full wp-image-23" /></a><a href="http://papermashup.com/demos/jquery-fullscreen-image/jquery-fullscreen-image.zip"><img src="http://papermashup.com/wp-content/uploads/2009/01/download.png" alt="download" title="download" class="alignnone size-full wp-image-24" /></a></p>
<h3>Conclusion</h3>
<p>This technique could be used in a number of ways, one that springs to mind would be a dynamic gallery where you click the thumbnails and it fills the screen with the image.</p>
]]></content:encoded>
			<wfw:commentRss>http://papermashup.com/jquery-scalable-fullscreen-background-image/feed/</wfw:commentRss>
		<slash:comments>17</slash:comments>
		</item>
	</channel>
</rss>

<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Page Caching using disk: enhanced
Database Caching 1/44 queries in 0.378 seconds using disk: basic
Object Caching 849/940 objects using disk: basic

Served from: papermashup.com @ 2012-05-17 08:30:16 -->
