<?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>Cagintranet Web Design &#187; jQuery</title>
	<atom:link href="http://www.cagintranet.com/cat/jquery/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.cagintranet.com</link>
	<description>Pittsburgh Web Design » Web Designer, Developer, Graphic Artist and Web 2.0 Guru</description>
	<lastBuildDate>Sun, 28 Aug 2011 03:10:29 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>Create an iPad-Like Dropdown (PopOver)</title>
		<link>http://www.cagintranet.com/archive/create-an-ipad-like-dropdown-popover/</link>
		<comments>http://www.cagintranet.com/archive/create-an-ipad-like-dropdown-popover/#comments</comments>
		<pubDate>Wed, 02 Feb 2011 02:44:42 +0000</pubDate>
		<dc:creator>Chris Cagle</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[jQuery]]></category>

		<guid isPermaLink="false">http://www.cagintranet.com/?p=759</guid>
		<description><![CDATA[I came up with this little bit of CSS and jQuery magic when working on the &#8220;Google Maps&#8221; version of BuyDeals.in. Download File or View Demo The HTML &#60;div id="popover"> &#60;div class="popover_triangle">&#60;/div> &#60;div class="header"> Choose Your City &#60;/div> &#60;div class="content"> &#60;ul> &#60;li>&#60;h6>Alabama&#60;/h6>&#60;/li> &#60;li class="item">&#60;a href="#/alabama/birmingham/" >Birmingham&#60;/a>&#60;/li> &#60;li class="item">&#60;a href="#/alabama/huntsville/" >Huntsville&#60;/a>&#60;/li> &#60;li class="item">&#60;a href="#/alabama/mobile/" >Mobile&#60;/a>&#60;/li> &#60;li>&#60;h6>Alaska&#60;/h6>&#60;/li> [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://www.cagintranet.com/design/wp-content/uploads/2011/01/popover.jpg" alt="" title="iPad Popover CSS3" width="500" height="299" class="alignnone size-full wp-image-833" /></p>
<p>I came up with this little bit of CSS and jQuery magic when working on the <a href="http://buydeals.in/map">&#8220;Google Maps&#8221; version of BuyDeals.in</a>.</p>
<p><a href="http://www.cagintranet.com/design/wp-content/uploads/2011/01/ipad-popover.zip">Download File</a> or <a href="http://www.cagintranet.com/code/css3-ipad-popover/">View Demo</a></p>
<h3>The HTML</h3>
<pre><code class="html">&lt;div id="popover">
	&lt;div class="popover_triangle">&lt;/div>
  &lt;div class="header">
    Choose Your City
  &lt;/div>
  &lt;div class="content">
    &lt;ul>
		&lt;li>&lt;h6>Alabama&lt;/h6>&lt;/li>
		&lt;li class="item">&lt;a href="#/alabama/birmingham/" >Birmingham&lt;/a>&lt;/li>
		&lt;li class="item">&lt;a href="#/alabama/huntsville/" >Huntsville&lt;/a>&lt;/li>
		&lt;li class="item">&lt;a href="#/alabama/mobile/" >Mobile&lt;/a>&lt;/li>
		&lt;li>&lt;h6>Alaska&lt;/h6>&lt;/li>
		&lt;li class="item">&lt;a href="#/alaska/anchorage/" >Anchorage&lt;/a>&lt;/li>
		&lt;li>&lt;h6>Arizona&lt;/h6>&lt;/li>
		&lt;li class="item">&lt;a href="#/arizona/mesa/" >Mesa&lt;/a>&lt;/li>
		&lt;li class="item">&lt;a href="#/arizona/phoenix/" >Phoenix&lt;/a>&lt;/li>
		&lt;li class="item">&lt;a href="#/arizona/scottsdale/" >Scottsdale&lt;/a>&lt;/li>
		&lt;li class="item">&lt;a href="#/arizona/tucson/" >Tucson&lt;/a>&lt;/li>
		&lt;li>&lt;h6>Arkansas&lt;/h6>&lt;/li>
		&lt;li class="item">&lt;a href="#/arkansas/little-rock/" >Little Rock&lt;/a>&lt;/li>
		&lt;li>&lt;h6>California&lt;/h6>&lt;/li>
		&lt;li class="item">&lt;a href="#/california/anaheim/" >Anaheim&lt;/a>&lt;/li> 

		...
		&lt;/ul>
  &lt;/div>
&lt;/div>
</code></pre>
<h3>The jQuery</h3>
<p>This is the javascript that opens (fades in) the popover and sets the button&#8217;s class to <code>active</code>.</p>
<pre><code class="javascript">$('#popover_button').live('click', function($e){
	$e.preventDefault();
	$('#popover').fadeToggle('fast');
	if ($('#popover_button').hasClass('active')) {
		$('#popover_button').removeClass('active');
	} else {
		$('#popover_button').addClass('active');
	}
});</code></pre>
<p>This is the javascript that closes the popover if anything else is clicked other than the button and/or the popover.</p>
<pre><code class="javascript">$('body').click(function(event) {
	if (!$(event.target).closest('#popover').length &#038;&#038; !$(event.target).closest('#popover_button').length) {
		$("#popover").stop(true, true).hide();
		$('#popover_button').removeClass('active');
	};
});</code></pre>
<h3>The CSS</h3>
<p>The <a href="http://www.cagintranet.com/code/css3-ipad-popover/lib/style.css">CSS file</a> for this demo is pretty straightforward. The one thing that might trip some people up is the fact that since the popover is absolutely positioned, it is given a <code>top</code> position. So to get it working in your particular instance, you will probably have to mess with the position properties to match where your button is.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.cagintranet.com/archive/create-an-ipad-like-dropdown-popover/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>jQuery Cycle Demo: HTML5, Dual Sliders and a Custom Pager</title>
		<link>http://www.cagintranet.com/archive/jquery-cycle-demo-html5-dual-sliders-and-a-custom-pager/</link>
		<comments>http://www.cagintranet.com/archive/jquery-cycle-demo-html5-dual-sliders-and-a-custom-pager/#comments</comments>
		<pubDate>Sun, 16 Jan 2011 20:53:34 +0000</pubDate>
		<dc:creator>Chris Cagle</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[Tutorials]]></category>

		<guid isPermaLink="false">http://www.cagintranet.com/?p=763</guid>
		<description><![CDATA[Here we customize the use of the popular jQuery plugin, Cycle. We use HTML5, a customized paging feature and pseudo dual sliders (one is a fade, but still looks cool). Download Files or View Demo The HTML5 Nothing really special here other than the fact that we use the new HTML5 Data- attributes to link [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://www.cagintranet.com/design/wp-content/uploads/2011/01/header-cycle.png" alt="" title="header-cycle" width="500" height="225" class="alignnone size-full wp-image-796" /></p>
<p>Here we customize the use of the popular jQuery plugin, <a href="http://malsup.com/jquery/cycle/" target="_blank" >Cycle</a>. We use HTML5, a customized paging feature and pseudo dual sliders (one is a fade, but still looks cool).</p>
<p><a href="http://www.cagintranet.com/design/wp-content/uploads/2011/01/cycle_demo.zip">Download Files</a> or <a href="http://www.cagintranet.com/code/cycle_demo/">View Demo</a></p>
<h3>The HTML5</h3>
<p>Nothing really special here other than the fact that we use the new <a href="http://html5doctor.com/html5-custom-data-attributes/" target="_blank" >HTML5 Data- attributes</a> to link the slides to their respective logos.</p>
<pre><code class="html">&lt;!DOCTYPE html>
&lt;html lang="en" >
&lt;head>
	&lt;meta charset="utf-8">
	&lt;title>Pittsburgh Sports : Teams &#038; Stadiums&lt;/title>
	&lt;link href="lib/reset.css" rel="stylesheet" />
	&lt;link href="lib/style.css" rel="stylesheet" />
	&lt;script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js">&lt;/script>
	&lt;script src="http://cloud.github.com/downloads/malsup/cycle/jquery.cycle.all.latest.js">&lt;/script>

	&lt;!--[if lt IE 9]>
		&lt;script src="http://html5shiv.googlecode.com/svn/trunk/html5.js">&lt;/script>
	&lt;![endif]-->
	&lt;!--[if lt IE 7 ]>
	  &lt;script src="lib/dd_belatedpng.js">&lt;/script>
	  &lt;script> DD_belatedPNG.fix('img, .png_bg'); //fix any &lt;img> or .png_bg background-images &lt;/script>
	&lt;![endif]-->

	&lt;script type="text/javascript" >
	jQuery(document).ready(function() {
		/* add javascript here */
	});
	&lt;/script>
&lt;/head>
&lt;body>

	&lt;div class="wrapper">
		&lt;header>
			&lt;h1>Pittsburgh Sports&lt;/h1>
			&lt;nav>
				&lt;ul id="nav">&lt;/ul>
			&lt;/nav>
		&lt;/header>
		&lt;div class="presentation">
			&lt;article id="slides">
				&lt;section data-team="steelers" title="Heinz Field" >&lt;img src="images/heinz.jpg" />&lt;/section>
				&lt;section data-team="penguins" title="Consol Energy Arena" >&lt;img src="images/consol.jpg" />&lt;/section>
				&lt;section data-team="pirates" title="PNC Park" >&lt;img src="images/pnc.jpg" />&lt;/section>
			&lt;/article>

			&lt;figure>
				&lt;img src="images/steelers_logo.png" data-team="steelers" />
				&lt;img src="images/penguins_logo.png" data-team="penguins" />
				&lt;img src="images/pirates_logo.png" data-team="pirates" />
			&lt;/figure>
		&lt;/div>

	&lt;/div>
&lt;/body>
&lt;/html></code></pre>
<h3>The jQuery</h3>
<p>The Malsup Cycle options can be <a href="http://jquery.malsup.com/cycle/options.html" target="_blank" >viewed here</a></p>
<ul>
<li><b>pager</b> &#8211; This is the #id of the empty <code>ul</code> element that gets populated with the new <code>li</code>&#8216;s that are generated by our <em>pageAnchorBuilder</em> function.</li>
<li><b>pageAnchorBuilder</b> &#8211; This is the function that custom builds own new menu. It pulls the title attribute of the <code>section</code> and uses it as the menu&#8217;s anchor text.</li>
<li><b>before</b> &#8211; This is the function that runs before the slide changes. We use it to hide &#8220;all&#8221; images within the <code>figure</code> element.</li>
<li><b>after</b> &#8211; This is the function that runs after the slide changes. We use it to <code><a href="http://api.jquery.com/fadeIn/" target="_blank" >fadeIn</a></code> the new slide&#8217;s corresponding logo.</li>
</ul>
<pre><code class="javascript">$('#slides').cycle({
	fx:     'scrollLeft',
	timeout: 0,
	speed:  1000,
	pager:  '#nav',
	pagerAnchorBuilder: function(idx, slide) {
	  var stadium = jQuery(slide).attr('data-team');
	  var title = jQuery(slide).attr('title');
	  return '&lt;li>&lt;a href="#/'+stadium+'">' + title + '&lt;/a>&lt;/li>';
	},
	before:  onBefore,
	after:   onAfter
});
function onBefore() {
	$('figure img').fadeOut('fast');
}
function onAfter() {
	var logo = $(this).attr('data-team');
	$('figure img[data-team='+ logo+']').fadeIn('slow');
}</code></pre>
]]></content:encoded>
			<wfw:commentRss>http://www.cagintranet.com/archive/jquery-cycle-demo-html5-dual-sliders-and-a-custom-pager/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Tutorial: How to Implement Uploadify into an Application</title>
		<link>http://www.cagintranet.com/archive/how-to-implement-uploadify-into-an-application/</link>
		<comments>http://www.cagintranet.com/archive/how-to-implement-uploadify-into-an-application/#comments</comments>
		<pubDate>Thu, 15 Oct 2009 10:00:32 +0000</pubDate>
		<dc:creator>Chris Cagle</dc:creator>
				<category><![CDATA[jQuery]]></category>
		<category><![CDATA[Tutorials]]></category>

		<guid isPermaLink="false">http://www.cagintranet.com/?p=522</guid>
		<description><![CDATA[Last week I showed how to implement Jcrop into an application. In this tutorial &#8211; which also pulls from my experiences developing GetSimple &#8211; I implement the jQuery plugin Uploadify. In this tutorial, we create a simple file upload script that also displays an unordered list of the files in the upload directory. The list [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://www.cagintranet.com/design/wp-content/uploads/2009/10/screenshot1.jpg" alt="How to Implement Uploadify into an Application" /></p>
<p>Last week I showed <a href="http://www.cagintranet.com/archive/how-to-use-jcrop-from-within-an-application/">how to implement Jcrop into an application</a>. In this tutorial &#8211; which also pulls from my experiences developing <a href="http://get-simple.info/">GetSimple</a> &#8211; I implement the jQuery plugin <a href="http://www.uploadify.com/">Uploadify</a>.</p>
<p>In this tutorial, we create a simple file upload script that also displays an unordered list of the files in the upload directory. The list of files refreshes via an ajax call every time Uploadify processes a queue.</p>
<h3>Demo</h3>
<p><a href="/code/uploadify-app/upload.php">View the demo</a> or <a href="/code/uploadify-app/uploadify-demo.zip">download the files</a></p>
<h3>The Basic HTML</h3>
<pre><code class="html">&lt;h2>Uploadify Application Demo &lt;span id="loader">&lt;img src="img/loading.gif" alt="Loading..." />&lt;/span>&lt;/h2>
&lt;div id="sidebar">
	&lt;!-- form to be replaced by uploadify -->
	&lt;form id="mainftp" action="upload.php" method="post" enctype="multipart/form-data">
		&lt;p>&lt;input type="file" name="file" id="file" />&lt;/p>
		&lt;p>&lt;input type="submit" name="submit" value="Upload" />&lt;/p>
	&lt;/form>
&lt;/div>

&lt;!-- whole div to be refreshed once uploadify is finished -->
&lt;div id="allfiles" >
	&lt;?php
		//list all files via function file included up top
		$handle = @opendir($src_folder) or die("Unable to open $src_folder");
		ListDir($handle,$src_folder);
	?>
&lt;/div></code></pre>
<h3>The PHP</h3>
<pre><code class="php">//folder where the files are stored at
//you may need to chmod this folder to 775 or 777 for it to work
$src_folder = 'files/';

//file that includes the function to list all files in ul
include("inc/file_list.php");

//if javascript is disabled, the ftp will still work
if (isset($_FILES["file"])) {
	if ($_FILES["file"]["error"] > 0) {
	  $error = 'Error Uploading!';
	} else {
    $count = '1';
    $file_loc = $path . $_FILES["file"]["name"];
    $base = $_FILES["file"]["name"];
    while ( file_exists($file_loc) ) {
		$file_loc = $path . $count.'-'. $_FILES["file"]["name"];
		$base = $count.'-'. $_FILES["file"]["name"];
		$count++;
	}
    move_uploaded_file($_FILES["file"]["tmp_name"], $file_loc);
	}
}</code></pre>
<h3>The jQuery</h3>
<pre><code class="javascript">$('#mainftp').uploadify({
	'uploader' : 'js/uploadify/uploadify.swf',
	'script' : 'js/uploadify/uploadify.php',
	'multi' : true,
	'auto' : true,
	'height' : '32',
	'width' : '250',
	'buttonImg' : 'img/browse.png',
	'cancelImg' : 'img/cancel.png',
	'folder' : 'files/',
	onProgress: function() {
		$('#loader').show();
	},
	onAllComplete: function() {
		$('#loader').hide();
		$('#allfiles').load(location.href+" #allfiles>*","");
	}
});</code></pre>
<p>Notes about this javascript:</p>
<ul>
<li>Uploadify was unzipped directly from the <a href="http://www.uploadify.com/download/">download on their site</a>. To upgrade, simply replace the <em>js/uploadify/</em> folder with the newer version.</li>
<li><b>height</b> and <b>width</b> are for the respective dimentions of your custom button image &#8211; the demo&#8217;s being in <em>img/browse.png</em></li>
<li><b>folder</b> is the location where the files will be uploaded to. This is also the folder that should be listed on line #3 of the PHP code above in the <em>$src_folder</em> variable.</li>
<li><b>$(&#8216;#loader&#8217;).show();</b> and <b>$(&#8216;#loader&#8217;).hide();</b> start and stop the loading gif that many applications use now to show that something is being uploaded/processed.</li>
<li><b>$(&#8216;#allfiles&#8217;).load(location.href+&#8221; #allfiles>*&#8221;,&#8221;");</b> &#8211; replaces the whole div with the id of <em>allfiles</em> with and updated listing with the newly uploaded files in it</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.cagintranet.com/archive/how-to-implement-uploadify-into-an-application/feed/</wfw:commentRss>
		<slash:comments>53</slash:comments>
		</item>
		<item>
		<title>Tutorial: How to Implement Jcrop into an Application</title>
		<link>http://www.cagintranet.com/archive/how-to-use-jcrop-from-within-an-application/</link>
		<comments>http://www.cagintranet.com/archive/how-to-use-jcrop-from-within-an-application/#comments</comments>
		<pubDate>Sat, 10 Oct 2009 20:17:19 +0000</pubDate>
		<dc:creator>Chris Cagle</dc:creator>
				<category><![CDATA[jQuery]]></category>
		<category><![CDATA[Tutorials]]></category>

		<guid isPermaLink="false">http://www.cagintranet.com/?p=507</guid>
		<description><![CDATA[When creating the &#8216;image control panel&#8217; for the latest version of GetSimple, I decided to integrate the wonderful Jcrop jQuery plugin into it. Amazingly, there are very few tutorials online that show the full extent of how to use Jcrop in real world situations. The only one I found that was of use was TalkInCode&#8217;s [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://www.cagintranet.com/design/wp-content/uploads/2009/10/screenshot.jpg " alt="How to use Jcrop from within an Application - Tutorial" /></p>
<p>When creating the &#8216;image control panel&#8217; for the latest version of <a href="http://get-simple.info/">GetSimple</a>, I decided to integrate the wonderful <a href="http://deepliquid.com/content/Jcrop.html">Jcrop jQuery plugin</a> into it. Amazingly, there are very few tutorials online that show the full extent of how to use Jcrop in real world situations. The only one I found that was of use was <a href="http://www.talkincode.com/jcrop-extension-implementation-in-php-932.html">TalkInCode&#8217;s tutorial</a>. I did start out using that example&#8217;s ImageManipulation class, but changed it slightly so that after submission, you are brought back to the original page instead of being shown the thumbnail.</p>
<h3>Demo &amp; Features</h3>
<p><a href="http://www.cagintranet.com/code/jcrop-app/image.php?i=pittsburgh.jpg">View the Demo</a> or <a href="http://www.cagintranet.com/code/jcrop-app/jcrop-demo.zip">download the files</a>.</p>
<p>Some of the more unique features of this demo are:</p>
<ul>
<li>The aspectRatio changes to 1:1 when ctrl-Q or command-Q is pressed</li>
<li>The dimensions of the selected area are shown in an interesting way</li>
<li>Stats on the thumbnail and the current image are displayed</li>
</ul>
<h3>The Basic HTML</h3>
<p><em>The demo/download has some extra code for displaying the image stats &amp; linking of the css, js and class files.</em></p>
<pre><code class="html">&lt;!-- image for Jcrop -->
&lt;img src="&lt;?php echo $src_folder . $src; ?>" id="cropbox" />

&lt;!-- selection dimentions -->
&lt;div id="handw" class="toggle" >Selection Dimentions&lt;br />&lt;span id="picw">&lt;/span> x &lt;span id="pich">&lt;/span>&lt;/div>

&lt;!-- form that Jcrop fills in -->
&lt;form id="jcropform" action="image.php?i=&lt;?php echo $src; ?>" method="post" onsubmit="return checkCoords();">
  &lt;input type="hidden" id="x" name="x" />
  &lt;input type="hidden" id="y" name="y" />
  &lt;input type="hidden" id="w" name="w" />
  &lt;input type="hidden" id="h" name="h" />
  &lt;input type="submit" class="submit" value="Create Thumbnail" />
  &nbsp; &lt;span class="small" >&lt;em>ctrl-Q&lt;/em> or &lt;em>command-Q&lt;/em> for square&lt;/span>
&lt;/form></code></pre>
<h3>The PHP</h3>
<pre><code class="php">//the name of the passed image
//example would be:   http://myapplication.com/image.php?i=photo.jpg
$src = $_GET['i'];

//folder where the images are
$src_folder = 'images/';

//folder where the thumbnails will be saved to
//you may need to chmod 775 or 777 this folder
$thumb_folder = 'images/thumbnails/'; 

if ($_SERVER['REQUEST_METHOD'] == 'POST'){

	require('inc/imagemanipulation.php');

	$objImage = new ImageManipulation($src_folder . $src);
	if ( $objImage->imageok ) {
		$objImage->setCrop($_POST['x'], $_POST['y'], $_POST['w'], $_POST['h']);
		$objImage->save($thumb_folder . 'thumbnail.' .$src);
	} else {
		echo 'Error!';
	}
}</code></pre>
<h3>The jQuery</h3>
<pre><code class="javascript">function updateCoords(c) {
	$('#handw').show();
  $('#x').val(c.x);
  $('#y').val(c.y);
  $('#w').val(c.w);
  $('#h').val(c.h);
  $('#pich').html(c.h);
  $('#picw').html(c.w);
};

function checkCoords()
{
  if (parseInt($('#x').val())) return true;
  alert('Please select a crop region then press submit.');
  return false;
};

jQuery(document).ready(function() { 

	$(window).load(function(){
	var api = $.Jcrop('#cropbox',{
    onChange: updateCoords,
    onSelect: updateCoords,
    boxWidth: 500,
    boxHeight: 500
  });
  var isCtrl = false;
	$(document).keyup(function (e) {
		api.setOptions({ aspectRatio: 0 });
		api.focus();
		if(e.which == 17) isCtrl=false;
	}).keydown(function (e) {
		if(e.which == 17) isCtrl=true;
		if(e.which == 81 &#038;&#038; isCtrl == true) {
			api.setOptions({ aspectRatio: 1 });
			api.focus();
		}
	});
});

});
</code></pre>
]]></content:encoded>
			<wfw:commentRss>http://www.cagintranet.com/archive/how-to-use-jcrop-from-within-an-application/feed/</wfw:commentRss>
		<slash:comments>13</slash:comments>
		</item>
	</channel>
</rss>

