<?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>Atomic Robot Design &#187; html</title>
	<atom:link href="http://atomicrobotdesign.com/blog/tag/html/feed/" rel="self" type="application/rss+xml" />
	<link>http://atomicrobotdesign.com/blog</link>
	<description>Design From The Future &#124; Blog</description>
	<lastBuildDate>Mon, 06 Feb 2012 03:13:03 +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>Adobe is in danger of losing the developer community, if they haven’t already</title>
		<link>http://atomicrobotdesign.com/blog/web-development/adobe-is-in-danger-of-losing-the-developer-community-if-they-havent-already/</link>
		<comments>http://atomicrobotdesign.com/blog/web-development/adobe-is-in-danger-of-losing-the-developer-community-if-they-havent-already/#comments</comments>
		<pubDate>Mon, 22 Aug 2011 01:04:59 +0000</pubDate>
		<dc:creator>Mike</dc:creator>
				<category><![CDATA[web development]]></category>
		<category><![CDATA[flash]]></category>
		<category><![CDATA[html]]></category>

		<guid isPermaLink="false">http://atomicrobotdesign.com/blog/?p=1140</guid>
		<description><![CDATA[Sometimes I wonder if we’ve got Adobe all wrong. Take a look at their products. Yes, people complain about their design products, Photoshop, Fireworks, InDesign, etc, but they’re pretty much the industry standard. All the designers I work with laugh &#8230; <a href="http://atomicrobotdesign.com/blog/web-development/adobe-is-in-danger-of-losing-the-developer-community-if-they-havent-already/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Sometimes I wonder if we’ve got Adobe all wrong. Take a look at their products. Yes, people complain about their design products, Photoshop, Fireworks, InDesign, etc, but they’re pretty much the industry standard. All the designers I work with laugh when they find out someone uses Corel Draw and Photoshop has become a verb it’s so popular. But take a look at Adobe’s developer tools. Nearly all the Flash developers I follow use programs like FDT or Flash Develop to build Flash programs, they won’t go near Adobe’s tools for their own platform. And whenever a web developer mentions they use Dreamweaver, they feel the need to defend their choice.</p>
<p>Now look at three of Adobe’s latest products: <a href="http://www.adobe.com/products/flashcatalyst.html">Flash Catalyst</a>, <a href="http://labs.adobe.com/technologies/edge/">Edge</a> and <a href="http://labs.adobe.com/technologies/muse/">Muse</a>. There’s one common thing to all these programs, build things without coding. This all leads me to believe one thing, Adobe gets how to build programs for designers but has no idea how to build anything for the serious developer. I’m a firm believer that Flash Catalyst was a direct response to designers saying they liked Flash better back when it was more of an animation tool that allowed a bit of coding. And you know what, I’m glad they made it, I don’t know if anyone actually uses it, but it hasn’t flooded the web with Flash sites that were any worse than people were putting out there before. Edge has potential, but I think it’s going to have to have it’s animations be canvas or SVG based to really catch on. And Muse to me is just a bad idea. The code it creates is awful and really, it’s just Dreamweaver with the code view removed.</p>
<p>I wasn’t the least but surprised by the web development community’s reaction to Muse. I pride myself in my ability to take a design and recreate it using HTML and CSS as close as a browser will let me. I spend a lot of time communicating with the designers I work with, I let them know what’s realistic and they let me know when they think I’m just being lazy. Muse seems to me to be evidence that Adobe feels developers are neck bearded nerds that don’t care how long you spent getting that gradient just right, they’re going to ruin your design because of things like functionality. So, Adobe is giving the designer the power to make their design look exactly like they want, no more arguing with those nerds that just don’t get it. But when Adobe’s example site has 1500 lines of HTML and someone recreates it using only 105 lines when they hand code it, it shows you how much Adobe missed the mark.</p>
<p>There was and maybe still is a way that Adobe could have avoided the developer backlash. Dreamweaver is actually a really decent code editor, it’s just expensive and most developers don’t want to be bothered with all the extra stuff it comes with. Adobe should come out with a cheap, or even free, version of Dreamweaver that’s just a code editor. Imagine if they’d released that at the same time as Muse? Look, Microsoft has two free coding environments that are actually really good and that I actually recommend to people, Visual Web Developer and WebMatrix and both are free.</p>
<p>But then again, has Adobe ever made a great coding environment? Flash Builder doesn’t seem to have the greatest reputation and Dreamweaver heyday was when it was built by Macromedia. I don’t think there’s been any major changes to Dreamweaver since Adobe bought it. And really, at $399, I doubt anyone that uses Dreamweaver actually bought it on it’s own, most people probably got it because they bought one of the Creative Suites. And who’s going to pay that much for something when you can get the same thing for free or for $29.</p>
<p>I think Adobe is fighting to stay relevant to the web design community but they’re doing it with the risk of alienating the web development community. I like Adobe and I like a lot of their products (any time I get to use After Effect is a good day), I think they are having trouble finding their place in the evolving world of the web.</p>
]]></content:encoded>
			<wfw:commentRss>http://atomicrobotdesign.com/blog/web-development/adobe-is-in-danger-of-losing-the-developer-community-if-they-havent-already/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>My quest to find the right code editor</title>
		<link>http://atomicrobotdesign.com/blog/general/my-quest-to-find-the-right-code-editor/</link>
		<comments>http://atomicrobotdesign.com/blog/general/my-quest-to-find-the-right-code-editor/#comments</comments>
		<pubDate>Mon, 28 Feb 2011 02:04:53 +0000</pubDate>
		<dc:creator>Mike</dc:creator>
				<category><![CDATA[general]]></category>
		<category><![CDATA[code editor]]></category>
		<category><![CDATA[css]]></category>
		<category><![CDATA[html]]></category>
		<category><![CDATA[jQuery]]></category>

		<guid isPermaLink="false">http://atomicrobotdesign.com/blog/?p=927</guid>
		<description><![CDATA[When I went to school to learn web design and development, it was right around the time when it became a matter of pride to say that you hand coded your work, that you didn’t use a WYSIWYG editor like &#8230; <a href="http://atomicrobotdesign.com/blog/general/my-quest-to-find-the-right-code-editor/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>When I went to school to learn web design and development, it was right around the time when it became a matter of pride to say that you hand coded your work, that you didn’t use a WYSIWYG editor like Dreamweaver has the reputation to be. Of course, since I was just getting into the web development world and my teachers taught us to make our first web sites using Notepad, the idea of using a WYSIWYG was and always has been completely foreign to me. Eventually, I moved on to using the code editor in Dreamweaver to do my HTML and CSS coding because I loved the code hinting. And I kept on using Dreamweaver until maybe six months ago. Why? I think I’ve said before, I find one thing that helps me code effectively is working in a comfortable atmosphere and since I’d been using Dreamweaver for so long, I had not yet found a code editor that could replace it for me.</p>
<p>Eventually, I came across <a href="http://www.activestate.com/komodo-edit">Komodo Edit</a>, which replaced Dreamweaver for me as my main editor. I love that it’s pretty light weight, free and has code hinting for everything from HTML5 to jQuery. I can’t say that I have any real complaints. It’s open source and there’s a pretty good community around it.</p>
<p>But before I came across Komodo Edit, I gave a ton of editors a chance. <a href="http://www.aptana.com/">Aptana</a> is OK but it can really start to run slow after a while and anyone who’s been in a hardcore coding stretch, it really sucks when your editor starts to slow down. I did a couple of video tutorial series on JavaScript and the host was using Microsoft’s <a href="http://www.microsoft.com/express/Web/">Visual Web Developer</a>, which I tried out, but it just has the feeling that it’s made to work with Microsoft technologies like .Net and I could never just get comfortable with it. Microsoft came out with <a href="http://www.microsoft.com/web/webmatrix/">Web Matrix</a>, which I gave a shot, and while it wasn’t bad, it just didn’t have some of the features I have become used to in a code editor.</p>
<p>I work on a computer running Windows, so I have to admit, when watching video tutorials where the host uses Textmate, sometimes I’d just a bit jealous because of some of the features it has that none of the editors I’ve used on Windows has. That was until I came across <a href="http://www.e-texteditor.com/">E</a>, a text editor for Windows that has, as far as I can tell, all the same features as Textmate. I’ve been playing around with it for the last couple of days and so far I’ve enjoyed it. But there’s one problem, it doesn’t have code hinting.</p>
<p>Komodo Edit has plug-ins that add some of the Textmate features I want, like using tab to insert code snippets, but it doesn’t work quite how I’d like and because most of the snippets that are included aren’t set up the way I’d like and it changes some of the functionality in ways that I’m not a fan of. I’m going to give E a chance but I’m not sure if I’m going to able to live without code hinting, it just speeds everything up so much and I’ve gotten so used to it.</p>
<p>I still firmly believe that what you use to build with doesn’t really matter, what matters is the end product, whether it’s an app or a website. I’m just searching for the right one for me. In fact, I shouldn’t have been surprised, but it seems most developers are as passionate about what editor they use as they are about what languages they use. </p>
]]></content:encoded>
			<wfw:commentRss>http://atomicrobotdesign.com/blog/general/my-quest-to-find-the-right-code-editor/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>How the hell did I become a JavaScript fan?</title>
		<link>http://atomicrobotdesign.com/blog/general/how-the-hell-did-i-become-a-javascript-fan/</link>
		<comments>http://atomicrobotdesign.com/blog/general/how-the-hell-did-i-become-a-javascript-fan/#comments</comments>
		<pubDate>Mon, 13 Dec 2010 06:20:17 +0000</pubDate>
		<dc:creator>Mike</dc:creator>
				<category><![CDATA[general]]></category>
		<category><![CDATA[css]]></category>
		<category><![CDATA[flash]]></category>
		<category><![CDATA[html]]></category>
		<category><![CDATA[HTML5]]></category>
		<category><![CDATA[javascript]]></category>

		<guid isPermaLink="false">http://atomicrobotdesign.com/blog/?p=780</guid>
		<description><![CDATA[If you had told me a year ago, or even six months ago, that I’d spend an entire day working with JavaScript and I’d enjoy it, I would have called you completely insane. Until recently, I was not a fan &#8230; <a href="http://atomicrobotdesign.com/blog/general/how-the-hell-did-i-become-a-javascript-fan/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>If you had told me a year ago, or even six months ago, that I’d spend an entire day working with JavaScript and I’d enjoy it, I would have called you completely insane. Until recently, I was not a fan of JavaScript, in fact, I avoided using it if I could. If I couldn’t build it with HTML/CSS then I built it in Flash. But once Google release Chrome, I started to see what you could do with JS and I began rethinking my position on it. I’ll admit when Apple trashed Flash, I was firmly in the “Flash isn’t dead and it and HTML5 can co-exist on the web” camp. In fact, I probably leaned back to the Flash side because of the anti-Flash attitudes some people had.</p>
<p>But I kept looking into JavaScript and got really excited about jQuery. jQuery is the perfect gateway drug to JS, I think. It allows you to get projects up and running quickly, and for me at least, it made me want to learn more straight JavaScript. Now I find myself trying to figure out a way to include some JavaScript effect into every site I work on.</p>
<p>I don’t think that JavaScript itself won me over, it’s the fact that the modern version of all the major browsers allow you to build things that would be nearly impossible without a plug-in a few years ago. But now, for a lot of effects like an animated drop down navigation, you just need to link to a JavaScript file and, bang, you’ve got the effect you’re after.</p>
<p>Plus, I think with JavaScript and ActionScript both being based on ECMAscript, learning one after being familiar with the other makes it really a situation of learning the differences between the languages than anything else. So switching my focus has been pretty easy for me but it has been without some frustration. Not strong typing variables took a bit of getting used to.</p>
<p>I still can’t believe that I get excited about JavaScript heavy projects but I think that the leaning of the web to move from plug-ins to browsers for dynamic website experiences has been a good thing. Plus, it’s taught me that as a web developer, you shouldn’t limit yourself to one or two technologies. Honestly, for the longest time, I was hoping that Flash would take over for HTML because of the crazy dynamic things you could build with it. But now, thanks to the innovations by Chrome and Firefox, it can be done with HTML/CSS/JS, which means you can build a great website experience with a text editor as simple as Notepad. Which is pretty cool when you think about it.</p>
]]></content:encoded>
			<wfw:commentRss>http://atomicrobotdesign.com/blog/general/how-the-hell-did-i-become-a-javascript-fan/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Fun with CSS3 Transform and some jQuery too</title>
		<link>http://atomicrobotdesign.com/blog/htmlcss/fun-with-css3-transform-and-some-jquery-too/</link>
		<comments>http://atomicrobotdesign.com/blog/htmlcss/fun-with-css3-transform-and-some-jquery-too/#comments</comments>
		<pubDate>Wed, 03 Nov 2010 05:09:20 +0000</pubDate>
		<dc:creator>Mike</dc:creator>
				<category><![CDATA[HTML/CSS]]></category>
		<category><![CDATA[css]]></category>
		<category><![CDATA[CSS3]]></category>
		<category><![CDATA[html]]></category>
		<category><![CDATA[jQuery]]></category>

		<guid isPermaLink="false">http://atomicrobotdesign.com/blog/?p=736</guid>
		<description><![CDATA[I am a huge fan of CSS3 transforms and transitions and can’t wait for the day when all the major browsers support them. Why? Well, as great as something like jQuery is, if you want to incorporate a transition or &#8230; <a href="http://atomicrobotdesign.com/blog/htmlcss/fun-with-css3-transform-and-some-jquery-too/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>I am a huge fan of CSS3 transforms and transitions and can’t wait for the day when all the major browsers support them. Why? Well, as great as something like jQuery is, if you want to incorporate a transition or animation as part of your design, the less files you have to load, the better. And the main purpose of CSS is to style the HTML, so using CSS for the animation just makes more sense to me. And because the animation is being render by the browser’s CSS engine, so far they’ve been incredibly smooth.</p>
<p>I’ve just been messing around with some transitions made a couple of examples of what you can do. You can check out the demo <a href="http://atomicrobotdesign.com/blog_media/css3_transforms.html">here</a>. </p>
<p>The first example is pure CSS. The animation is triggered by the :active selector which unfortunately won’t let you just click on the div to tigger it. The second example uses jQuery to toggle the a class on and off to trigger the animation. Although I’m using jQuery here, it’s just to trigger the effect, the animation is still 100% CSS.</p>
]]></content:encoded>
			<wfw:commentRss>http://atomicrobotdesign.com/blog/htmlcss/fun-with-css3-transform-and-some-jquery-too/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Slide up captions using CSS3 transitions</title>
		<link>http://atomicrobotdesign.com/blog/htmlcss/slide-up-captions-using-css3-transitions/</link>
		<comments>http://atomicrobotdesign.com/blog/htmlcss/slide-up-captions-using-css3-transitions/#comments</comments>
		<pubDate>Mon, 01 Nov 2010 00:31:31 +0000</pubDate>
		<dc:creator>Mike</dc:creator>
				<category><![CDATA[HTML/CSS]]></category>
		<category><![CDATA[CSS3]]></category>
		<category><![CDATA[html]]></category>
		<category><![CDATA[javascript]]></category>

		<guid isPermaLink="false">http://atomicrobotdesign.com/blog/?p=729</guid>
		<description><![CDATA[A couple of days ago, I came across an example using CSS3 transitions over at CSS-Tricks that was pretty cool but also reminded me of something I’d made a while back. I was just messing around trying to add a &#8230; <a href="http://atomicrobotdesign.com/blog/htmlcss/slide-up-captions-using-css3-transitions/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>A couple of days ago, I came across an example using CSS3 transitions over at <a href="http://css-tricks.com/examples/SlideupBoxes/">CSS-Tricks</a> that was pretty cool but also reminded me of something I’d made a while back. I was just messing around trying to add a slide up caption to an image and just seeing if it was even possible. I love to see if you can replace common web effects that use JavaScript with just CSS3.</p>
<p>And using CSS3 transitions, it’s actually really easy to set up some sliding captions using just CSS. Here’s the HTML I used:</p>
<div class="codecolorer-container html4strict twitlight" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:600px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br /></div></td><td><div class="html4strict codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #009900;">&lt;<a href="http://december.com/html/4/element/div.html"><span style="color: #000000; font-weight: bold;">div</span></a> <span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;wrapper&quot;</span>&gt;</span><br />
&nbsp;<span style="color: #009900;">&lt;<a href="http://december.com/html/4/element/div.html"><span style="color: #000000; font-weight: bold;">div</span></a> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;slider&quot;</span> <span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;batman&quot;</span>&gt;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&lt;<a href="http://december.com/html/4/element/div.html"><span style="color: #000000; font-weight: bold;">div</span></a>&gt;&lt;<a href="http://december.com/html/4/element/p.html"><span style="color: #000000; font-weight: bold;">p</span></a>&gt;</span>Batman is not amused<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><a href="http://december.com/html/4/element/p.html"><span style="color: #000000; font-weight: bold;">p</span></a>&gt;&lt;<span style="color: #66cc66;">/</span><a href="http://december.com/html/4/element/div.html"><span style="color: #000000; font-weight: bold;">div</span></a>&gt;</span><br />
&nbsp;<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><a href="http://december.com/html/4/element/div.html"><span style="color: #000000; font-weight: bold;">div</span></a>&gt;</span><br />
&nbsp;<span style="color: #009900;">&lt;<a href="http://december.com/html/4/element/div.html"><span style="color: #000000; font-weight: bold;">div</span></a> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;slider&quot;</span> <span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;spiderman&quot;</span>&gt;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&lt;<a href="http://december.com/html/4/element/div.html"><span style="color: #000000; font-weight: bold;">div</span></a>&gt;&lt;<a href="http://december.com/html/4/element/p.html"><span style="color: #000000; font-weight: bold;">p</span></a>&gt;</span>Spider-Man has a hyphen<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><a href="http://december.com/html/4/element/p.html"><span style="color: #000000; font-weight: bold;">p</span></a>&gt;&lt;<span style="color: #66cc66;">/</span><a href="http://december.com/html/4/element/div.html"><span style="color: #000000; font-weight: bold;">div</span></a>&gt;</span><br />
&nbsp;<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><a href="http://december.com/html/4/element/div.html"><span style="color: #000000; font-weight: bold;">div</span></a>&gt;</span><br />
&nbsp;<span style="color: #009900;">&lt;<a href="http://december.com/html/4/element/div.html"><span style="color: #000000; font-weight: bold;">div</span></a> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;slider&quot;</span> <span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;wolverine&quot;</span>&gt;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&lt;<a href="http://december.com/html/4/element/div.html"><span style="color: #000000; font-weight: bold;">div</span></a>&gt;&lt;<a href="http://december.com/html/4/element/p.html"><span style="color: #000000; font-weight: bold;">p</span></a>&gt;</span>Wolverine is in too many comics<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><a href="http://december.com/html/4/element/p.html"><span style="color: #000000; font-weight: bold;">p</span></a>&gt;&lt;<span style="color: #66cc66;">/</span><a href="http://december.com/html/4/element/div.html"><span style="color: #000000; font-weight: bold;">div</span></a>&gt;</span><br />
&nbsp;<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><a href="http://december.com/html/4/element/div.html"><span style="color: #000000; font-weight: bold;">div</span></a>&gt;</span><br />
<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><a href="http://december.com/html/4/element/div.html"><span style="color: #000000; font-weight: bold;">div</span></a>&gt;</span></div></td></tr></tbody></table></div>
<p>Here I’ve created three divs that each have an id but also share the slider class. And the div inside the parent slider div is going to be the one that we apply the transition effect to. Next, we just need to set up the CSS:</p>
<div class="codecolorer-container css twitlight" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:600px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br />12<br />13<br />14<br />15<br />16<br />17<br />18<br />19<br />20<br />21<br />22<br />23<br />24<br />25<br />26<br />27<br />28<br />29<br />30<br />31<br />32<br />33<br />34<br />35<br />36<br />37<br />38<br />39<br /></div></td><td><div class="css codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #cc00cc;">#wrapper</span> <span style="color: #00AA00;">&#123;</span><br />
&nbsp;<span style="color: #000000; font-weight: bold;">width</span><span style="color: #00AA00;">:</span><span style="color: #933;">300px</span><span style="color: #00AA00;">;</span><br />
&nbsp;<span style="color: #000000; font-weight: bold;">margin</span><span style="color: #00AA00;">:</span><span style="color: #993333;">auto</span><span style="color: #00AA00;">;</span><br />
<span style="color: #00AA00;">&#125;</span><br />
<span style="color: #cc00cc;">#batman</span> <span style="color: #00AA00;">&#123;</span><br />
&nbsp;<span style="color: #000000; font-weight: bold;">background</span><span style="color: #00AA00;">:</span><span style="color: #993333;">url</span><span style="color: #00AA00;">&#40;</span><span style="color: #ff0000; font-style: italic;">images/batman.jpg</span><span style="color: #00AA00;">&#41;</span> <span style="color: #993333;">no-repeat</span><span style="color: #00AA00;">;</span><br />
<span style="color: #00AA00;">&#125;</span><br />
<span style="color: #cc00cc;">#spiderman</span> <span style="color: #00AA00;">&#123;</span><br />
&nbsp;<span style="color: #000000; font-weight: bold;">background</span><span style="color: #00AA00;">:</span><span style="color: #993333;">url</span><span style="color: #00AA00;">&#40;</span><span style="color: #ff0000; font-style: italic;">images/spiderman.jpg</span><span style="color: #00AA00;">&#41;</span> <span style="color: #993333;">no-repeat</span><span style="color: #00AA00;">;</span><br />
&nbsp;<span style="color: #000000; font-weight: bold;">margin-top</span><span style="color: #00AA00;">:</span><span style="color: #933;">20px</span><span style="color: #00AA00;">;</span><br />
<span style="color: #00AA00;">&#125;</span><br />
<span style="color: #cc00cc;">#wolverine</span> <span style="color: #00AA00;">&#123;</span><br />
&nbsp;<span style="color: #000000; font-weight: bold;">background</span><span style="color: #00AA00;">:</span><span style="color: #993333;">url</span><span style="color: #00AA00;">&#40;</span><span style="color: #ff0000; font-style: italic;">images/wolverine.jpg</span><span style="color: #00AA00;">&#41;</span> <span style="color: #993333;">no-repeat</span><span style="color: #00AA00;">;</span><br />
&nbsp;<span style="color: #000000; font-weight: bold;">margin-top</span><span style="color: #00AA00;">:</span><span style="color: #933;">20px</span><span style="color: #00AA00;">;</span><br />
<span style="color: #00AA00;">&#125;</span><br />
<span style="color: #6666ff;">.slider</span> <span style="color: #00AA00;">&#123;</span><br />
&nbsp;<span style="color: #000000; font-weight: bold;">width</span><span style="color: #00AA00;">:</span><span style="color: #933;">300px</span><span style="color: #00AA00;">;</span><br />
&nbsp;<span style="color: #000000; font-weight: bold;">height</span><span style="color: #00AA00;">:</span><span style="color: #933;">169px</span><span style="color: #00AA00;">;</span><br />
&nbsp;<span style="color: #000000; font-weight: bold;">overflow</span><span style="color: #00AA00;">:</span><span style="color: #993333;">hidden</span><span style="color: #00AA00;">;</span><br />
<span style="color: #00AA00;">&#125;</span><br />
<span style="color: #6666ff;">.slider</span> div <span style="color: #00AA00;">&#123;</span><br />
&nbsp;<span style="color: #000000; font-weight: bold;">width</span><span style="color: #00AA00;">:</span><span style="color: #933;">300px</span><span style="color: #00AA00;">;</span><br />
&nbsp;<span style="color: #000000; font-weight: bold;">line-height</span><span style="color: #00AA00;">:</span><span style="color: #933;">30px</span><span style="color: #00AA00;">;</span><br />
&nbsp;<span style="color: #000000; font-weight: bold;">padding-top</span><span style="color: #00AA00;">:</span><span style="color: #933;">169px</span><span style="color: #00AA00;">;</span><br />
&nbsp;-moz-transition<span style="color: #00AA00;">:</span>all 0.2s linear<span style="color: #00AA00;">;</span><br />
&nbsp;-webkit-transition<span style="color: #00AA00;">:</span>all 0.2s linear<span style="color: #00AA00;">;</span><br />
&nbsp;-o-transition<span style="color: #00AA00;">:</span>all 0.2s linear<span style="color: #00AA00;">;</span><br />
<span style="color: #00AA00;">&#125;</span><br />
<span style="color: #6666ff;">.slider</span> div<span style="color: #3333ff;">:hover </span><span style="color: #00AA00;">&#123;</span><br />
&nbsp;<span style="color: #000000; font-weight: bold;">padding-top</span><span style="color: #00AA00;">:</span><span style="color: #933;">139px</span><span style="color: #00AA00;">;</span><br />
<span style="color: #00AA00;">&#125;</span><br />
<span style="color: #6666ff;">.slider</span> div p <span style="color: #00AA00;">&#123;</span><br />
&nbsp; <span style="color: #000000; font-weight: bold;">margin</span><span style="color: #00AA00;">:</span><span style="color: #cc66cc;">0</span><span style="color: #00AA00;">;</span><br />
&nbsp; <span style="color: #000000; font-weight: bold;">padding-left</span><span style="color: #00AA00;">:</span><span style="color: #933;">5px</span><span style="color: #00AA00;">;</span><br />
&nbsp; <span style="color: #000000; font-weight: bold;">background</span><span style="color: #00AA00;">:</span>rgba<span style="color: #00AA00;">&#40;</span><span style="color: #cc66cc;">0</span><span style="color: #00AA00;">,</span><span style="color: #cc66cc;">0</span><span style="color: #00AA00;">,</span><span style="color: #cc66cc;">0</span><span style="color: #00AA00;">,</span><span style="color: #cc66cc;">0.5</span><span style="color: #00AA00;">&#41;</span><span style="color: #00AA00;">;</span><br />
&nbsp; <span style="color: #000000; font-weight: bold;">height</span><span style="color: #00AA00;">:</span><span style="color: #933;">30px</span><span style="color: #00AA00;">;</span><br />
&nbsp; <span style="color: #000000; font-weight: bold;">color</span><span style="color: #00AA00;">:</span><span style="color: #cc00cc;">#fff</span><span style="color: #00AA00;">;</span><br />
&nbsp; <span style="color: #000000; font-weight: bold;">font-family</span><span style="color: #3333ff;">:Arial</span><span style="color: #00AA00;">,</span> <span style="color: #993333;">sans-serif</span><span style="color: #00AA00;">;</span><br />
<span style="color: #00AA00;">&#125;</span></div></td></tr></tbody></table></div>
<p>The important stuff here is what’s in .slider and it’s child properties. First we set the height and the width of the slider div and it’s overflow to hidden, this will hide the caption.</p>
<div class="codecolorer-container css twitlight" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:600px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br /></div></td><td><div class="css codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #6666ff;">.slider</span> <span style="color: #00AA00;">&#123;</span><br />
&nbsp;<span style="color: #000000; font-weight: bold;">width</span><span style="color: #00AA00;">:</span><span style="color: #933;">300px</span><span style="color: #00AA00;">;</span><br />
&nbsp;<span style="color: #000000; font-weight: bold;">height</span><span style="color: #00AA00;">:</span><span style="color: #933;">169px</span><span style="color: #00AA00;">;</span><br />
&nbsp;<span style="color: #000000; font-weight: bold;">overflow</span><span style="color: #00AA00;">:</span><span style="color: #993333;">hidden</span><span style="color: #00AA00;">;</span><br />
<span style="color: #00AA00;">&#125;</span></div></td></tr></tbody></table></div>
<p>Next, we set up the div inside the slider div. The important parts here is the padding-top is set to be the same as the height of the slider div. And here we set the transition properties, I’ve put in all for the property we want to effect just to make things easier, but it could also be set to padding-top and work the exact same. The time is set to 0.2 seconds because no one wants to wait to see a caption.</p>
<div class="codecolorer-container css twitlight" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:600px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br /></div></td><td><div class="css codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #6666ff;">.slider</span> div <span style="color: #00AA00;">&#123;</span><br />
&nbsp;<span style="color: #000000; font-weight: bold;">width</span><span style="color: #00AA00;">:</span><span style="color: #933;">300px</span><span style="color: #00AA00;">;</span><br />
&nbsp;<span style="color: #000000; font-weight: bold;">line-height</span><span style="color: #00AA00;">:</span><span style="color: #933;">30px</span><span style="color: #00AA00;">;</span><br />
&nbsp;<span style="color: #000000; font-weight: bold;">padding-top</span><span style="color: #00AA00;">:</span><span style="color: #933;">169px</span><span style="color: #00AA00;">;</span><br />
&nbsp;-moz-transition<span style="color: #00AA00;">:</span>all 0.2s linear<span style="color: #00AA00;">;</span><br />
&nbsp;-webkit-transition<span style="color: #00AA00;">:</span>all 0.2s linear<span style="color: #00AA00;">;</span><br />
&nbsp;-o-transition<span style="color: #00AA00;">:</span>all 0.2s linear<span style="color: #00AA00;">;</span><br />
<span style="color: #00AA00;">&#125;</span></div></td></tr></tbody></table></div>
<p>The property that we are going to change to make this effect work is the padding at the top of the div inside the slider div. Why? Because using CSS we can only effect an element that we are hovering over or clicking on. So we have to set the padding so we can shrink it and have the child paragraph tag slide up.</p>
<div class="codecolorer-container css twitlight" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:600px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br /></div></td><td><div class="css codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #6666ff;">.slider</span> div<span style="color: #3333ff;">:hover </span><span style="color: #00AA00;">&#123;</span><br />
&nbsp;<span style="color: #000000; font-weight: bold;">padding-top</span><span style="color: #00AA00;">:</span><span style="color: #933;">139px</span><span style="color: #00AA00;">;</span><br />
<span style="color: #00AA00;">&#125;</span></div></td></tr></tbody></table></div>
<p>You can check out a demo <a href="http://atomicrobotdesign.com/blog_media/csstransitions.html">here</a>.</p>
<p>The rest of the CSS is just for styling. Building something like this isn’t that complicated but there is something that I have added to my CSS wish list. I wish there was some way to set it in CSS that when you are interacting with one element on the page, you can have the effect on another element. This was something I thought we’d be able to do with the :target pseudo selector but it doesn’t appear to <a href="http://dev.opera.com/articles/view/css3-target-based-interfaces/">work that way</a>. I’d love it if we could do something like this:</p>
<div class="codecolorer-container css twitlight" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:600px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br /></div></td><td><div class="css codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #6666ff;">.slider</span><span style="color: #3333ff;">:hover</span><span style="color: #00AA00;">:</span>target<span style="color: #00AA00;">&#91;</span>.slider-up<span style="color: #00AA00;">&#93;</span> <span style="color: #00AA00;">&#123;</span><br />
&nbsp;<span style="color: #000000; font-weight: bold;">top</span><span style="color: #00AA00;">:</span><span style="color: #933;">-20px</span><span style="color: #00AA00;">;</span><br />
<span style="color: #00AA00;">&#125;</span></div></td></tr></tbody></table></div>
<p>This way we could set it up so that when the user hovers over the slider div, the slider-up div moves up 20 pixels. Maybe something like that will be added in the future, it really would make CSS even more powerful.</p>
]]></content:encoded>
			<wfw:commentRss>http://atomicrobotdesign.com/blog/htmlcss/slide-up-captions-using-css3-transitions/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Make customizable jQuery plug-ins and be more awesome</title>
		<link>http://atomicrobotdesign.com/blog/web-development/make-customizable-jquery-plug-ins-and-be-more-awesome/</link>
		<comments>http://atomicrobotdesign.com/blog/web-development/make-customizable-jquery-plug-ins-and-be-more-awesome/#comments</comments>
		<pubDate>Fri, 22 Oct 2010 05:06:35 +0000</pubDate>
		<dc:creator>Mike</dc:creator>
				<category><![CDATA[web development]]></category>
		<category><![CDATA[css]]></category>
		<category><![CDATA[html]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[jQuery]]></category>

		<guid isPermaLink="false">http://atomicrobotdesign.com/blog/?p=711</guid>
		<description><![CDATA[The great thing about making you’re own plug-ins is that once you’ve built something, you can easily use it again. But most of the time you’ll want to change some of the settings on your plug-in and it can be &#8230; <a href="http://atomicrobotdesign.com/blog/web-development/make-customizable-jquery-plug-ins-and-be-more-awesome/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>The great thing about making you’re own plug-ins is that once you’ve built something, you can easily use it again. But most of the time you’ll want to change some of the settings on your plug-in and it can be annoying to have to edit it every time you use it. With a jQuery plug-in, we can set up the plug-in to accept variables so that we can customize it every time we use it. This is perfect for plug-ins that create pop-up windows or image sliders.</p>
<p>We are going to take the totally usefull plug-in we made <a href="http://atomicrobotdesign.com/blog/web-development/write-your-own-jquery-plug-ins-because-it-will-make-your-life-a-lot-easier/">last time</a> and change it so we can pick the new background color and also so we can set a new width of the div. The HTML and CSS are the same:</p>
<div class="codecolorer-container html4strict twitlight" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:600px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br />12<br />13<br />14<br />15<br />16<br />17<br />18<br />19<br />20<br />21<br />22<br />23<br />24<br />25<br />26<br />27<br />28<br /></div></td><td><div class="html4strict codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #00bbdd;">&lt;!DOCTYPE html&gt;</span><br />
<span style="color: #009900;">&lt;<a href="http://december.com/html/4/element/html.html"><span style="color: #000000; font-weight: bold;">html</span></a> <span style="color: #000066;">lang</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;en&quot;</span>&gt;</span><br />
<span style="color: #009900;">&lt;<a href="http://december.com/html/4/element/head.html"><span style="color: #000000; font-weight: bold;">head</span></a>&gt;</span><br />
<span style="color: #009900;">&lt;<a href="http://december.com/html/4/element/meta.html"><span style="color: #000000; font-weight: bold;">meta</span></a> <span style="color: #000066;">charset</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;utf-8&quot;</span> <span style="color: #66cc66;">/</span>&gt;</span><br />
<span style="color: #009900;">&lt;<a href="http://december.com/html/4/element/title.html"><span style="color: #000000; font-weight: bold;">title</span></a>&gt;</span>jQuery Plug-in<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><a href="http://december.com/html/4/element/title.html"><span style="color: #000000; font-weight: bold;">title</span></a>&gt;</span><br />
<span style="color: #009900;">&lt;<a href="http://december.com/html/4/element/script.html"><span style="color: #000000; font-weight: bold;">script</span></a> <span style="color: #000066;">src</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;http://ajax.googleapis.com/ajax/libs/jquery/1.4.3/jquery.min.js&quot;</span>&gt;&lt;<span style="color: #66cc66;">/</span><a href="http://december.com/html/4/element/script.html"><span style="color: #000000; font-weight: bold;">script</span></a>&gt;</span><br />
<span style="color: #009900;">&lt;<a href="http://december.com/html/4/element/style.html"><span style="color: #000000; font-weight: bold;">style</span></a>&gt;</span><br />
#blue {<br />
&nbsp; width:200px;<br />
&nbsp; height:200px;<br />
&nbsp; background:#00f;<br />
&nbsp; float:left;<br />
&nbsp; margin-right:20px;<br />
}<br />
#red {<br />
&nbsp; width:200px;<br />
&nbsp; height:200px;<br />
&nbsp; background:#f00;<br />
&nbsp; float:left;<br />
}<br />
<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><a href="http://december.com/html/4/element/style.html"><span style="color: #000000; font-weight: bold;">style</span></a>&gt;</span><br />
<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><a href="http://december.com/html/4/element/head.html"><span style="color: #000000; font-weight: bold;">head</span></a>&gt;</span><br />
<br />
<span style="color: #009900;">&lt;<a href="http://december.com/html/4/element/body.html"><span style="color: #000000; font-weight: bold;">body</span></a>&gt;</span><br />
&nbsp; <span style="color: #009900;">&lt;<a href="http://december.com/html/4/element/div.html"><span style="color: #000000; font-weight: bold;">div</span></a> <span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;blue&quot;</span>&gt;&lt;<span style="color: #66cc66;">/</span><a href="http://december.com/html/4/element/div.html"><span style="color: #000000; font-weight: bold;">div</span></a>&gt;</span><br />
&nbsp; <span style="color: #009900;">&lt;<a href="http://december.com/html/4/element/div.html"><span style="color: #000000; font-weight: bold;">div</span></a> <span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;red&quot;</span>&gt;&lt;<span style="color: #66cc66;">/</span><a href="http://december.com/html/4/element/div.html"><span style="color: #000000; font-weight: bold;">div</span></a>&gt;</span><br />
<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><a href="http://december.com/html/4/element/body.html"><span style="color: #000000; font-weight: bold;">body</span></a>&gt;</span><br />
<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><a href="http://december.com/html/4/element/html.html"><span style="color: #000000; font-weight: bold;">html</span></a>&gt;</span></div></td></tr></tbody></table></div>
<p>Same as last time, nothing major here. Next we’ll modify our plug-in to allow us to pass in some variables:</p>
<div class="codecolorer-container javascript twitlight" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:600px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br />12<br />13<br /></div></td><td><div class="javascript codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>$<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span><br />
&nbsp; $.<span style="color: #660066;">fn</span>.<span style="color: #660066;">our_plugin</span> <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>vars<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> &nbsp;<br />
&nbsp; &nbsp; <span style="color: #003366; font-weight: bold;">var</span> element <span style="color: #339933;">=</span> <span style="color: #000066; font-weight: bold;">this</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #003366; font-weight: bold;">var</span> color <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span>vars.<span style="color: #660066;">color</span> <span style="color: #339933;">!=</span> undefined<span style="color: #009900;">&#41;</span> <span style="color: #339933;">?</span> vars.<span style="color: #660066;">color</span> <span style="color: #339933;">:</span> <span style="color: #3366CC;">'#0f0'</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #003366; font-weight: bold;">var</span> width <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span>vars.<span style="color: #660066;">width</span> <span style="color: #339933;">!=</span> undefined<span style="color: #009900;">&#41;</span> <span style="color: #339933;">?</span> vars.<span style="color: #660066;">width</span> <span style="color: #339933;">:</span> <span style="color: #CC0000;">400</span><span style="color: #339933;">;</span> <br />
&nbsp; &nbsp; element.<span style="color: #660066;">click</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; element.<span style="color: #660066;">css</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #3366CC;">'background-color'</span> <span style="color: #339933;">:</span> color<span style="color: #339933;">,</span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #3366CC;">'width'</span> <span style="color: #339933;">:</span> width <span style="color: #339933;">+</span> <span style="color: #3366CC;">'px'</span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; <span style="color: #009900;">&#125;</span><br />
<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#40;</span>jQuery<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></div></td></tr></tbody></table></div>
<p>Ok, so what’s going on here? Well, the first change from our early plug-in is in the second line:</p>
<div class="codecolorer-container javascript twitlight" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:600px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br /></div></td><td><div class="javascript codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">$.<span style="color: #660066;">fn</span>.<span style="color: #660066;">our_plugin</span> <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>vars<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span></div></td></tr></tbody></table></div>
<p>We are passing in our variables from the HTML file through vars. With this we can pass through as many variables as we want to. This time we’re passing two plus the element in the HTML document that we want to affect, this will give us these three variables:</p>
<div class="codecolorer-container javascript twitlight" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:600px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br /></div></td><td><div class="javascript codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #003366; font-weight: bold;">var</span> element <span style="color: #339933;">=</span> <span style="color: #000066; font-weight: bold;">this</span><span style="color: #339933;">;</span><br />
<span style="color: #003366; font-weight: bold;">var</span> color <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span>vars.<span style="color: #660066;">color</span> <span style="color: #339933;">!=</span> undefined<span style="color: #009900;">&#41;</span> <span style="color: #339933;">?</span> vars.<span style="color: #660066;">color</span> <span style="color: #339933;">:</span> <span style="color: #3366CC;">'#0f0'</span><span style="color: #339933;">;</span><br />
<span style="color: #003366; font-weight: bold;">var</span> width <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span>vars.<span style="color: #660066;">width</span> <span style="color: #339933;">!=</span> undefined<span style="color: #009900;">&#41;</span> <span style="color: #339933;">?</span> vars.<span style="color: #660066;">width</span> <span style="color: #339933;">:</span> <span style="color: #CC0000;">400</span><span style="color: #339933;">;</span></div></td></tr></tbody></table></div>
<p>The first one, clicked, is the same as last time, but the other two look a lot different and might be a bit confusing to some one that’s not familiar with JavaScript shorthand. What we are doing here is setting the variable color to what we set color to in the HTML file or else to #0f0. This is the same as an if statement.</p>
<div class="codecolorer-container javascript twitlight" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:600px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br /></div></td><td><div class="javascript codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>vars.<span style="color: #660066;">color</span> <span style="color: #339933;">!=</span> undefined<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; color <span style="color: #339933;">=</span> vars.<span style="color: #660066;">color</span><span style="color: #339933;">;</span><br />
<span style="color: #009900;">&#125;</span> <span style="color: #000066; font-weight: bold;">else</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; color <span style="color: #339933;">=</span> ‘#0f0’<span style="color: #339933;">;</span><br />
<span style="color: #009900;">&#125;</span></div></td></tr></tbody></table></div>
<p>So we are saying if vars.color isn’t undefined, color equals vars.color or else color equals green. We do this so that if we don’t set a color then the plug-in will default to green. And we’re doing the same with width, if we don’t set it, then the default with is 400 pixels. We could also set this to null and then run an if statement later, but this is simpler. Next is the actual meat of the plug-in:</p>
<div class="codecolorer-container javascript twitlight" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:600px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br /></div></td><td><div class="javascript codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">element.<span style="color: #660066;">click</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; element.<span style="color: #660066;">css</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #3366CC;">'background-color'</span> <span style="color: #339933;">:</span> color<span style="color: #339933;">,</span><br />
&nbsp; &nbsp; <span style="color: #3366CC;">'width'</span> <span style="color: #339933;">:</span> width <span style="color: #339933;">+</span> <span style="color: #3366CC;">'px'</span><br />
&nbsp; <span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></div></td></tr></tbody></table></div>
<p>Here we’re saying when element is clicked then change the CSS properties for element. Now we have to set up how we call the plug-in in our HTML file:</p>
<div class="codecolorer-container javascript twitlight" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:600px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br /></div></td><td><div class="javascript codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">$<span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; $<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'#blue'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">our_plugin</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; width<span style="color: #339933;">:</span> <span style="color: #CC0000;">100</span><br />
&nbsp; <span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; $<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'#red'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">our_plugin</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; color<span style="color: #339933;">:</span> <span style="color: #3366CC;">'yellow'</span><br />
&nbsp; <span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></div></td></tr></tbody></table></div>
<p>We’re calling our plug-in for both the #blue and #red divs and we are setting the width for the #blue div to 100 pixels and the background color of the #red div is being changed to yellow. So now when the #blue div is clicked it changes to a width of 100 pixels and changes to a green background whereas the #red div will become 400 pixels wide and get a yellow background.</p>
<p>And that’s all there is to setting up a jQuery plug-in that has custom values. Building your plug-ins this way makes them even more useful and enables you to use them over and over without having to edit the actual JavaScript file.</p>
]]></content:encoded>
			<wfw:commentRss>http://atomicrobotdesign.com/blog/web-development/make-customizable-jquery-plug-ins-and-be-more-awesome/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Write your own jQuery plug-ins because it will make your life a lot easier</title>
		<link>http://atomicrobotdesign.com/blog/web-development/write-your-own-jquery-plug-ins-because-it-will-make-your-life-a-lot-easier/</link>
		<comments>http://atomicrobotdesign.com/blog/web-development/write-your-own-jquery-plug-ins-because-it-will-make-your-life-a-lot-easier/#comments</comments>
		<pubDate>Wed, 20 Oct 2010 03:06:19 +0000</pubDate>
		<dc:creator>Mike</dc:creator>
				<category><![CDATA[web development]]></category>
		<category><![CDATA[html]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[jQuery]]></category>

		<guid isPermaLink="false">http://atomicrobotdesign.com/blog/?p=705</guid>
		<description><![CDATA[jQuery has made my life so much easier and in fact I think it’s one of those things that’s just made the web a better experience for everyone because it works the same in every browser. It’s one of those &#8230; <a href="http://atomicrobotdesign.com/blog/web-development/write-your-own-jquery-plug-ins-because-it-will-make-your-life-a-lot-easier/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p><a href="http://jquery.com/">jQuery</a> has made my life so much easier and in fact I think it’s one of those things that’s just made the web a better experience for everyone because it works the same in every browser. It’s one of those things where it’s easy to learn and most of the effects or events you want to add to a site have already been built by someone else and they’ve put it out there for you to use. And one of the best things about it is how easy it is to build your own plug-in so you don’t have to worry about rewriting code for the same effect.</p>
<p>We’ll write a quick plug-in here just to show you how simple it is. Here’s the HTML and CSS:</p>
<div class="codecolorer-container html4strict twitlight" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:600px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br />12<br />13<br />14<br />15<br />16<br />17<br />18<br />19<br />20<br />21<br />22<br />23<br />24<br />25<br />26<br />27<br />28<br /></div></td><td><div class="html4strict codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #00bbdd;">&lt;!DOCTYPE html&gt;</span><br />
<span style="color: #009900;">&lt;<a href="http://december.com/html/4/element/html.html"><span style="color: #000000; font-weight: bold;">html</span></a> <span style="color: #000066;">lang</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;en&quot;</span>&gt;</span><br />
<span style="color: #009900;">&lt;<a href="http://december.com/html/4/element/head.html"><span style="color: #000000; font-weight: bold;">head</span></a>&gt;</span><br />
<span style="color: #009900;">&lt;<a href="http://december.com/html/4/element/meta.html"><span style="color: #000000; font-weight: bold;">meta</span></a> <span style="color: #000066;">charset</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;utf-8&quot;</span> <span style="color: #66cc66;">/</span>&gt;</span><br />
<span style="color: #009900;">&lt;<a href="http://december.com/html/4/element/title.html"><span style="color: #000000; font-weight: bold;">title</span></a>&gt;</span>jQuery Plug-in<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><a href="http://december.com/html/4/element/title.html"><span style="color: #000000; font-weight: bold;">title</span></a>&gt;</span><br />
<span style="color: #009900;">&lt;<a href="http://december.com/html/4/element/script.html"><span style="color: #000000; font-weight: bold;">script</span></a> <span style="color: #000066;">src</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;http://ajax.googleapis.com/ajax/libs/jquery/1.4.3/jquery.min.js&quot;</span>&gt;&lt;<span style="color: #66cc66;">/</span><a href="http://december.com/html/4/element/script.html"><span style="color: #000000; font-weight: bold;">script</span></a>&gt;</span><br />
<span style="color: #009900;">&lt;<a href="http://december.com/html/4/element/style.html"><span style="color: #000000; font-weight: bold;">style</span></a>&gt;</span><br />
#blue {<br />
&nbsp; width:200px;<br />
&nbsp; height:200px;<br />
&nbsp; background:#00f;<br />
&nbsp; float:left;<br />
&nbsp; margin-right:20px;<br />
}<br />
#red {<br />
&nbsp; width:200px;<br />
&nbsp; height:200px;<br />
&nbsp; background:#f00;<br />
&nbsp; float:left;<br />
}<br />
<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><a href="http://december.com/html/4/element/style.html"><span style="color: #000000; font-weight: bold;">style</span></a>&gt;</span><br />
<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><a href="http://december.com/html/4/element/head.html"><span style="color: #000000; font-weight: bold;">head</span></a>&gt;</span><br />
<br />
<span style="color: #009900;">&lt;<a href="http://december.com/html/4/element/body.html"><span style="color: #000000; font-weight: bold;">body</span></a>&gt;</span><br />
&nbsp; <span style="color: #009900;">&lt;<a href="http://december.com/html/4/element/div.html"><span style="color: #000000; font-weight: bold;">div</span></a> <span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;blue&quot;</span>&gt;&lt;<span style="color: #66cc66;">/</span><a href="http://december.com/html/4/element/div.html"><span style="color: #000000; font-weight: bold;">div</span></a>&gt;</span><br />
&nbsp; <span style="color: #009900;">&lt;<a href="http://december.com/html/4/element/div.html"><span style="color: #000000; font-weight: bold;">div</span></a> <span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;red&quot;</span>&gt;&lt;<span style="color: #66cc66;">/</span><a href="http://december.com/html/4/element/div.html"><span style="color: #000000; font-weight: bold;">div</span></a>&gt;</span><br />
<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><a href="http://december.com/html/4/element/body.html"><span style="color: #000000; font-weight: bold;">body</span></a>&gt;</span><br />
<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><a href="http://december.com/html/4/element/html.html"><span style="color: #000000; font-weight: bold;">html</span></a>&gt;</span></div></td></tr></tbody></table></div>
<p>We’re just making two boxes, one red and one blue. And we’ve linked to directly to Google’s CDN of jQuery. Now we’re going to make it so when you click either one of the boxes, they turn green. Pretty much useless but I think it’s a good way for a beginner to see how to set this up. Now for our jQuery file. Open a blank file, I’ve called mine our_plugin.js and start off with this:</p>
<div class="codecolorer-container javascript twitlight" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:600px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br /></div></td><td><div class="javascript codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>$<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span><br />
<br />
<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#40;</span>jQuery<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></div></td></tr></tbody></table></div>
<p>That’s how every plug-in is going to start, we’re assigning the $ to jQuery so the browser knows what to do when it loads the file. Next, we need to set up and name our function:</p>
<div class="codecolorer-container javascript twitlight" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:600px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br /></div></td><td><div class="javascript codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>$<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span><br />
&nbsp; $.<span style="color: #660066;">fn</span>.<span style="color: #660066;">our_plugin</span> <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; <br />
&nbsp; <span style="color: #009900;">&#125;</span><br />
<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#40;</span>jQuery<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></div></td></tr></tbody></table></div>
<p>The standard is to name your plug-in the same as the file name. Honestly, I don’t know if this would still work if you didn’t. Now for the actually meat and bones of this thing:</p>
<div class="codecolorer-container javascript twitlight" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:600px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br /></div></td><td><div class="javascript codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>$<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span><br />
&nbsp; $.<span style="color: #660066;">fn</span>.<span style="color: #660066;">our_plugin</span> <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #003366; font-weight: bold;">var</span> clicked <span style="color: #339933;">=</span> <span style="color: #000066; font-weight: bold;">this</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; clicked.<span style="color: #660066;">click</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; clicked.<span style="color: #660066;">css</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'background-color'</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">'#0f0'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; <span style="color: #009900;">&#125;</span><br />
<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#40;</span>jQuery<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></div></td></tr></tbody></table></div>
<p>What’s going on here is that we are assigning whatever we’ve passed to our plug-in from our HTML file to the variable name clicked. And then we are saying when clicked is clicked run this function where we are changing the background color of whatever we passed into the function.</p>
<p>And that’s it. It’s pretty quick when you’re just doing something simple. Remember, this is just to show the basics of how you going about setting up a jQuery plug-in. But we aren’t done yet. Even if you linked to the our_plugin.js file, nothing would happen. We just need to add a little bit more to the HTML file:</p>
<div class="codecolorer-container javascript twitlight" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:600px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br /></div></td><td><div class="javascript codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #339933;">&lt;</span>script src<span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;our_plugin.js&quot;</span><span style="color: #339933;">&gt;&lt;/</span>script<span style="color: #339933;">&gt;</span><br />
<span style="color: #339933;">&lt;</span>script<span style="color: #339933;">&gt;</span><br />
$<span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; $<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'#blue'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">our_plugin</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; $<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'#red'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">our_plugin</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<span style="color: #339933;">&lt;/</span>script<span style="color: #339933;">&gt;</span></div></td></tr></tbody></table></div>
<p>The usual place to add this is at the top in between the head tags or at the end, just before the closing body tag. Remember to have it after the script tag that loads jQuery though, or else it won’t work.</p>
<p>So what’s happening here? Well, first, we’re passing the #blue div to our plug-in and then next we’re passing the #red div. And now when you click on either div they’ll change to green. Yes, it’s really that easy to set up.</p>
<p>Next time, I’m going to show you how to build one that’s a bit more complicated, where you’ll set up some variables that you can control when calling the plug-in in your HTML file.</p>
]]></content:encoded>
			<wfw:commentRss>http://atomicrobotdesign.com/blog/web-development/write-your-own-jquery-plug-ins-because-it-will-make-your-life-a-lot-easier/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>It’s cool your thing works in Webkit but doesn’t that make it kinda useless?</title>
		<link>http://atomicrobotdesign.com/blog/web-development/its-cool-your-thing-works-in-webkit-but-doesnt-that-make-it-kinda-useless/</link>
		<comments>http://atomicrobotdesign.com/blog/web-development/its-cool-your-thing-works-in-webkit-but-doesnt-that-make-it-kinda-useless/#comments</comments>
		<pubDate>Sat, 16 Oct 2010 23:07:07 +0000</pubDate>
		<dc:creator>Mike</dc:creator>
				<category><![CDATA[web development]]></category>
		<category><![CDATA[CSS3]]></category>
		<category><![CDATA[Firefox]]></category>
		<category><![CDATA[html]]></category>
		<category><![CDATA[IE]]></category>
		<category><![CDATA[webkit]]></category>

		<guid isPermaLink="false">http://atomicrobotdesign.com/blog/?p=699</guid>
		<description><![CDATA[Today on Hacker News, I saw this link, IE9 is the IE6 of CSS3. The authors point has some validity to it, I’ve said before I’m disappointed in IE9’s CSS3 support but I don’t think it’s as bad as this &#8230; <a href="http://atomicrobotdesign.com/blog/web-development/its-cool-your-thing-works-in-webkit-but-doesnt-that-make-it-kinda-useless/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Today on <a href="http://news.ycombinator.com/news">Hacker News</a>, I saw this link, <a href="http://css3wizardry.com/2010/08/14/ie9-is-the-ie6-of-css3/">IE9 is the IE6 of CSS3</a>. The authors point has some validity to it, I’ve said before I’m disappointed in IE9’s CSS3 support but I don’t think it’s as bad as this article makes out to be. And in the comments on Hacker News, a few people made a couple of points I completely agreed with, one being we don’t get to see the HTML or CSS behind the screenshots, so we don’t know if a couple of changes could fix everything. And two, why is he just comparing it to the two major Webkit browsers? Firefox has nearly <a href="http://en.wikipedia.org/wiki/Browser_usage_share">twice the market share</a> of Safari and Chrome combined. This is something I’ve been noticing a lot, building something that works in Webkit and then say “I didn’t test it in Firefox and of course it won’t work in IE.”</p>
<p>Webkit has become the favorite of developers over the last couple of months, I think for a couple of reasons. First, the two major browsers using Webkit, Chrome and Safari are pushing forward and both have fast JS engines, Chrome especially. Second, a lot of web designers use a Mac and a fair amount of them use Safari as their main browser, so of course you’re going to use the browser you’re comfortable with when you’re building something.</p>
<p>But here’s the thing, most of the people on web, by a vast majority, don’t use Webkit. I switch back and forth between Firefox and Chrome and I try to get everyone I know to use one of them. But the fact is, no matter how great your thing is in Webkit, if it doesn’t work in even Firefox, then it’s useless. At least until the other browsers catch up. At work, my bosses only care that it works right in IE and then Firefox because those are the browsers the clients use and a majority of clients don’t care that there’s more than one browser out there, which is a unfortunate fact. I check them in Chrome and Safari but I’ve never been asked about it.</p>
<p>So really, if your effect or transition or design only works in Webkit then how many people are going to see it? If it’s just an experiment that you made and it’s really only for other designers and developers to look at, then it doesn’t matter. But if it’s something that you think has real commercial value, then you’ll either have to find a way to make it work another way using something like jQuery or you’ll have to wait for the other browsers to catch up. Personally, I wish the <a href="http://www.apple.com/html5/showcase/vr/">CSS3 3D transforms</a> worked in every browser and not just Webkit.</p>
<p>I’m not saying that we shouldn’t be making things that only work in one browser, especially if we’re just doing it show off what the browser or we can do. I’ve made things that only work in Webkit or worse, only work in Firefox 4 beta. But usually those are just to show what the future is going to hold for us. Webkit is great and hopefully IE catches up soon and I’m sure they eventually will. But don’t be a Webkit snob, it’s almost as bad as being an Apple snob.</p>
]]></content:encoded>
			<wfw:commentRss>http://atomicrobotdesign.com/blog/web-development/its-cool-your-thing-works-in-webkit-but-doesnt-that-make-it-kinda-useless/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>When should you use Flash?</title>
		<link>http://atomicrobotdesign.com/blog/flash/when-should-you-use-flash/</link>
		<comments>http://atomicrobotdesign.com/blog/flash/when-should-you-use-flash/#comments</comments>
		<pubDate>Sun, 03 Oct 2010 06:59:54 +0000</pubDate>
		<dc:creator>Mike</dc:creator>
				<category><![CDATA[flash]]></category>
		<category><![CDATA[html]]></category>
		<category><![CDATA[javascript]]></category>

		<guid isPermaLink="false">http://atomicrobotdesign.com/blog/?p=684</guid>
		<description><![CDATA[Some people would say that the answer is never but I’m going to have to disagree with them. For the past maybe 8 years or so, Flash has been the only way to do a lot of the more dynamic &#8230; <a href="http://atomicrobotdesign.com/blog/flash/when-should-you-use-flash/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Some people would say that the answer is never but I’m going to have to disagree with them. For the past maybe 8 years or so, Flash has been the only way to do a lot of the more dynamic effects and sites on the web. Even now, with JavaScript engines performing far beyond what anyone expected a few years ago, Flash still might be the best way to go.</p>
<p>I will say there are times when I see Flash being used and it frustrates me. I don’t see any need now to use Flash for only the navigation on an otherwise HTML site. I’ve yet to see an effect special enough to justify it. Most, if not all, of the Flash effects I’ve seen on website navigations I’ve seen could either be created with JavaScript or wasn’t worth the extra memory. It goes without saying that Flash intros are long dead and so are Flash banners used to in the header of a website. I’ve built sites with these and usually they just feature something movie or a sheen moving across quickly and they end up being more annoying then adding anything to the design. Also, if you’re Flash site looks like an HTML site, then you really wasted you time building it in Flash.</p>
<p>Flash still has it’s strengths though. I really think that if you want to create and experience, you still need to use Flash. Firefox 4 shows <a href="http://atomicrobotdesign.com/blog/htmlcss/css3-transitions-on-transforms-in-firefox-4/">some of the potential</a> of what we’ll be able to do eventually with just CSS but for now, Flash is still the way to go. Great examples of sites like this are usually made by companies who want a site to showcase a product. Car companies do this a lot with Flash sites that mix in a lot of different media, like video and other interactive elements.</p>
<p>Personally, I think video is going to be the domain of Flash for the next couple of years, for two reasons. 1) Until IE9 becomes the main version of IE on the market a majority of the browsers out there don’t recognize the video tag and 2) Until one of the codecs become dominant, Flash will be the easiest way to get your video online. Plus, until the end of IE6, you’ll always need to have Flash as at least a back up if IE6 users are part of your target audience.</p>
<p>Flash is a long way from dead but I think it’s feeling the backlash of developers overusing it for the past few years. I’m still a big fan of Flash and I really believe that sometimes Flash is still your best option to build interactive features on a website. If you’re someone like me, who is still learning JavaScript, in order to get things built fast and to know it will function how you want, Flash is right there. And a big point I think that a lot of people miss is the average Internet surfer doesn’t care what you built it in as long as it works.</p>
]]></content:encoded>
			<wfw:commentRss>http://atomicrobotdesign.com/blog/flash/when-should-you-use-flash/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Glowing nav effect using jQuery</title>
		<link>http://atomicrobotdesign.com/blog/htmlcss/glowing-nav-effect-using-jquery/</link>
		<comments>http://atomicrobotdesign.com/blog/htmlcss/glowing-nav-effect-using-jquery/#comments</comments>
		<pubDate>Fri, 10 Sep 2010 01:00:05 +0000</pubDate>
		<dc:creator>Mike</dc:creator>
				<category><![CDATA[HTML/CSS]]></category>
		<category><![CDATA[css]]></category>
		<category><![CDATA[html]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[jQuery]]></category>

		<guid isPermaLink="false">http://atomicrobotdesign.com/blog/?p=648</guid>
		<description><![CDATA[I’m a big fan of the design of Fullyillustrated.com and one of the things that caught my eye is the glow effect on the navigation. Setting up something like this is actually a lot easier than you’d first think as &#8230; <a href="http://atomicrobotdesign.com/blog/htmlcss/glowing-nav-effect-using-jquery/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>I’m a big fan of the design of <a href="http://www.fullyillustrated.com/">Fullyillustrated.com</a> and one of the things that caught my eye is the glow effect on the navigation. Setting up something like this is actually a lot easier than you’d first think as long as you know basic jQuery. I’m not sure exactly how it’s done on the site but I’ve figured out how I’d do it based on <a href="http://net.tutsplus.com/tutorials/html-css-techniques/how-to-build-a-lava-lamp-style-navigation-menu/">code by Jeffrey Way over at Nettuts+</a>. I’m not going to go over this step by step, if you want to get a better understanding of the jQuery, watch Jeffrey’s video.</p>
<p>Here’s a <a href="http://atomicrobotdesign.com/blog_media/green_nav.html">demo</a> of the effect.</p>
<p>Our HTML:</p>
<div class="codecolorer-container html4strict twitlight" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:600px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br />12<br />13<br />14<br />15<br />16<br />17<br /></div></td><td><div class="html4strict codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #009900;">&lt;<a href="http://december.com/html/4/element/div.html"><span style="color: #000000; font-weight: bold;">div</span></a> <span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;container&quot;</span>&gt;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&lt;<a href="http://december.com/html/4/element/ul.html"><span style="color: #000000; font-weight: bold;">ul</span></a> <span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;nav&quot;</span>&gt;</span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #009900;">&lt;<a href="http://december.com/html/4/element/li.html"><span style="color: #000000; font-weight: bold;">li</span></a> <span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;selected&quot;</span>&gt;&lt;<a href="http://december.com/html/4/element/a.html"><span style="color: #000000; font-weight: bold;">a</span></a> <span style="color: #000066;">href</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;#&quot;</span>&gt;</span>Home<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><a href="http://december.com/html/4/element/a.html"><span style="color: #000000; font-weight: bold;">a</span></a>&gt;&lt;<span style="color: #66cc66;">/</span><a href="http://december.com/html/4/element/li.html"><span style="color: #000000; font-weight: bold;">li</span></a>&gt;</span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #009900;">&lt;<a href="http://december.com/html/4/element/li.html"><span style="color: #000000; font-weight: bold;">li</span></a>&gt;&lt;<a href="http://december.com/html/4/element/a.html"><span style="color: #000000; font-weight: bold;">a</span></a> <span style="color: #000066;">href</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;#&quot;</span>&gt;</span>About<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><a href="http://december.com/html/4/element/a.html"><span style="color: #000000; font-weight: bold;">a</span></a>&gt;&lt;<span style="color: #66cc66;">/</span><a href="http://december.com/html/4/element/li.html"><span style="color: #000000; font-weight: bold;">li</span></a>&gt;</span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #009900;">&lt;<a href="http://december.com/html/4/element/li.html"><span style="color: #000000; font-weight: bold;">li</span></a>&gt;&lt;<a href="http://december.com/html/4/element/a.html"><span style="color: #000000; font-weight: bold;">a</span></a> <span style="color: #000066;">href</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;#&quot;</span>&gt;</span>Blog<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><a href="http://december.com/html/4/element/a.html"><span style="color: #000000; font-weight: bold;">a</span></a>&gt;&lt;<span style="color: #66cc66;">/</span><a href="http://december.com/html/4/element/li.html"><span style="color: #000000; font-weight: bold;">li</span></a>&gt;</span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #009900;">&lt;<a href="http://december.com/html/4/element/li.html"><span style="color: #000000; font-weight: bold;">li</span></a>&gt;&lt;<a href="http://december.com/html/4/element/a.html"><span style="color: #000000; font-weight: bold;">a</span></a> <span style="color: #000066;">href</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;#&quot;</span>&gt;</span>Portfolio<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><a href="http://december.com/html/4/element/a.html"><span style="color: #000000; font-weight: bold;">a</span></a>&gt;&lt;<span style="color: #66cc66;">/</span><a href="http://december.com/html/4/element/li.html"><span style="color: #000000; font-weight: bold;">li</span></a>&gt;</span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #009900;">&lt;<a href="http://december.com/html/4/element/li.html"><span style="color: #000000; font-weight: bold;">li</span></a>&gt;&lt;<a href="http://december.com/html/4/element/a.html"><span style="color: #000000; font-weight: bold;">a</span></a> <span style="color: #000066;">href</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;#&quot;</span>&gt;</span>Contact<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><a href="http://december.com/html/4/element/a.html"><span style="color: #000000; font-weight: bold;">a</span></a>&gt;&lt;<span style="color: #66cc66;">/</span><a href="http://december.com/html/4/element/li.html"><span style="color: #000000; font-weight: bold;">li</span></a>&gt;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><a href="http://december.com/html/4/element/ul.html"><span style="color: #000000; font-weight: bold;">ul</span></a>&gt;</span><br />
&nbsp; <span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><a href="http://december.com/html/4/element/div.html"><span style="color: #000000; font-weight: bold;">div</span></a>&gt;</span><br />
&nbsp; <span style="color: #009900;">&lt;<a href="http://december.com/html/4/element/script.html"><span style="color: #000000; font-weight: bold;">script</span></a> <span style="color: #000066;">src</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;http://ajax.googleapis.com/ajax/libs/jquery/1.4.1/jquery.min.js&quot;</span>&gt;&lt;<span style="color: #66cc66;">/</span><a href="http://december.com/html/4/element/script.html"><span style="color: #000000; font-weight: bold;">script</span></a>&gt;</span><br />
&nbsp; <span style="color: #009900;">&lt;<a href="http://december.com/html/4/element/script.html"><span style="color: #000000; font-weight: bold;">script</span></a> <span style="color: #000066;">src</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;http://ajax.googleapis.com/ajax/libs/jqueryui/1.7.2/jquery-ui.min.js&quot;</span>&gt;&lt;<span style="color: #66cc66;">/</span><a href="http://december.com/html/4/element/script.html"><span style="color: #000000; font-weight: bold;">script</span></a>&gt;</span><br />
&nbsp; <span style="color: #009900;">&lt;<a href="http://december.com/html/4/element/script.html"><span style="color: #000000; font-weight: bold;">script</span></a> <span style="color: #000066;">src</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;jquery.glowNav.js&quot;</span>&gt;&lt;<span style="color: #66cc66;">/</span><a href="http://december.com/html/4/element/script.html"><span style="color: #000000; font-weight: bold;">script</span></a>&gt;</span><br />
&nbsp; <span style="color: #009900;">&lt;<a href="http://december.com/html/4/element/script.html"><span style="color: #000000; font-weight: bold;">script</span></a>&gt;</span><br />
&nbsp; $('#nav').glowNav({<br />
&nbsp; &nbsp; <br />
&nbsp; });<br />
&nbsp; <span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><a href="http://december.com/html/4/element/script.html"><span style="color: #000000; font-weight: bold;">script</span></a>&gt;</span></div></td></tr></tbody></table></div>
<p>All we have here is a basic website nav, links to jQuery, jQuery UI and our jQuery code.</p>
<p>The CSS:</p>
<div class="codecolorer-container css twitlight" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:600px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br />12<br />13<br />14<br />15<br />16<br />17<br />18<br />19<br />20<br />21<br />22<br />23<br />24<br />25<br />26<br />27<br />28<br />29<br />30<br />31<br />32<br />33<br />34<br />35<br />36<br />37<br />38<br /></div></td><td><div class="css codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #00AA00;">*</span> <span style="color: #00AA00;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">padding</span><span style="color: #00AA00;">:</span><span style="color: #cc66cc;">0</span><span style="color: #00AA00;">;</span><br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">margin</span><span style="color: #00AA00;">:</span><span style="color: #cc66cc;">0</span><span style="color: #00AA00;">;</span><br />
<span style="color: #00AA00;">&#125;</span><br />
<span style="color: #cc00cc;">#container</span> <span style="color: #00AA00;">&#123;</span><br />
&nbsp; <span style="color: #000000; font-weight: bold;">width</span><span style="color: #00AA00;">:</span><span style="color: #933;">680px</span><span style="color: #00AA00;">;</span><br />
&nbsp; <span style="color: #000000; font-weight: bold;">margin</span><span style="color: #00AA00;">:</span><span style="color: #933;">100px</span> <span style="color: #993333;">auto</span><span style="color: #00AA00;">;</span><br />
<span style="color: #00AA00;">&#125;</span><br />
<span style="color: #cc00cc;">#glow</span> <span style="color: #00AA00;">&#123;</span><br />
&nbsp; <span style="color: #000000; font-weight: bold;">background</span><span style="color: #00AA00;">:</span><span style="color: #993333;">url</span><span style="color: #00AA00;">&#40;</span><span style="color: #ff0000; font-style: italic;">green_glow.png</span><span style="color: #00AA00;">&#41;</span> <span style="color: #000000; font-weight: bold;">bottom</span> <span style="color: #993333;">center</span> <span style="color: #993333;">no-repeat</span><span style="color: #00AA00;">;</span><br />
&nbsp; <span style="color: #000000; font-weight: bold;">position</span><span style="color: #00AA00;">:</span><span style="color: #993333;">absolute</span><span style="color: #00AA00;">;</span><br />
&nbsp; <span style="color: #000000; font-weight: bold;">z-index</span><span style="color: #00AA00;">:</span><span style="color: #cc66cc;">1</span><span style="color: #00AA00;">;</span><br />
<span style="color: #00AA00;">&#125;</span><br />
<span style="color: #cc00cc;">#nav</span> <span style="color: #00AA00;">&#123;</span><br />
&nbsp; <span style="color: #000000; font-weight: bold;">position</span><span style="color: #00AA00;">:</span><span style="color: #993333;">relative</span><span style="color: #00AA00;">;</span><br />
&nbsp; <span style="color: #000000; font-weight: bold;">background</span><span style="color: #00AA00;">:</span><span style="color: #cc00cc;">#000</span><span style="color: #00AA00;">;</span><br />
&nbsp; <span style="color: #000000; font-weight: bold;">float</span><span style="color: #00AA00;">:</span><span style="color: #000000; font-weight: bold;">left</span><span style="color: #00AA00;">;</span><br />
<span style="color: #00AA00;">&#125;</span><br />
<span style="color: #cc00cc;">#nav</span> li <span style="color: #00AA00;">&#123;</span><br />
&nbsp; <span style="color: #000000; font-weight: bold;">float</span><span style="color: #00AA00;">:</span><span style="color: #000000; font-weight: bold;">left</span><span style="color: #00AA00;">;</span><br />
&nbsp; <span style="color: #000000; font-weight: bold;">list-style</span><span style="color: #00AA00;">:</span><span style="color: #993333;">none</span><span style="color: #00AA00;">;</span><br />
<span style="color: #00AA00;">&#125;</span><br />
<span style="color: #cc00cc;">#nav</span> li a <span style="color: #00AA00;">&#123;</span><br />
&nbsp; <span style="color: #000000; font-weight: bold;">color</span><span style="color: #00AA00;">:</span><span style="color: #cc00cc;">#ccc</span><span style="color: #00AA00;">;</span><br />
&nbsp; <span style="color: #000000; font-weight: bold;">position</span><span style="color: #00AA00;">:</span><span style="color: #993333;">relative</span><span style="color: #00AA00;">;</span><br />
&nbsp; <span style="color: #000000; font-weight: bold;">z-index</span><span style="color: #00AA00;">:</span><span style="color: #cc66cc;">2</span><span style="color: #00AA00;">;</span><br />
&nbsp; <span style="color: #000000; font-weight: bold;">float</span><span style="color: #00AA00;">:</span><span style="color: #000000; font-weight: bold;">left</span><span style="color: #00AA00;">;</span><br />
&nbsp; <span style="color: #000000; font-weight: bold;">font-size</span><span style="color: #00AA00;">:</span><span style="color: #933;">16px</span><span style="color: #00AA00;">;</span><br />
&nbsp; <span style="color: #000000; font-weight: bold;">font-family</span><span style="color: #3333ff;">:helvetica</span><span style="color: #00AA00;">,</span> arial<span style="color: #00AA00;">,</span> <span style="color: #993333;">sans-serif</span><span style="color: #00AA00;">;</span><br />
&nbsp; <span style="color: #000000; font-weight: bold;">text-decoration</span><span style="color: #00AA00;">:</span><span style="color: #993333;">none</span><span style="color: #00AA00;">;</span><br />
&nbsp; <span style="color: #000000; font-weight: bold;">padding</span><span style="color: #00AA00;">:</span><span style="color: #933;">20px</span> <span style="color: #933;">45px</span> <span style="color: #00AA00;">;</span><br />
<span style="color: #00AA00;">&#125;</span><br />
<span style="color: #cc00cc;">#nav</span> li a<span style="color: #3333ff;">:hover </span><span style="color: #00AA00;">&#123;</span><br />
&nbsp; <span style="color: #000000; font-weight: bold;">color</span><span style="color: #00AA00;">:</span><span style="color: #cc00cc;">#fff</span><span style="color: #00AA00;">;</span> &nbsp;<br />
<span style="color: #00AA00;">&#125;</span><br />
li<span style="color: #cc00cc;">#selected</span> a <span style="color: #00AA00;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">color</span><span style="color: #00AA00;">:</span><span style="color: #cc00cc;">#fff</span><span style="color: #00AA00;">;</span><br />
<span style="color: #00AA00;">&#125;</span></div></td></tr></tbody></table></div>
<p>Here we’re setting the green_glow.png as the background to #glow. #glow also has a z-index of 1 and the links have a z-index of 2 to make sure that they appear on the top. Other than that, the CSS is just basic styling.</p>
<p>The JavaScript:</p>
<div class="codecolorer-container javascript twitlight" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:600px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br />12<br />13<br />14<br />15<br />16<br />17<br />18<br />19<br />20<br />21<br />22<br />23<br />24<br />25<br />26<br />27<br />28<br />29<br />30<br />31<br />32<br />33<br />34<br />35<br />36<br />37<br />38<br />39<br />40<br />41<br />42<br />43<br />44<br />45<br />46<br />47<br />48<br />49<br />50<br />51<br />52<br />53<br />54<br />55<br /></div></td><td><div class="javascript codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>$<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; $.<span style="color: #660066;">fn</span>.<span style="color: #660066;">glowNav</span> <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>options<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; options <span style="color: #339933;">=</span> $.<span style="color: #660066;">extend</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; overlap<span style="color: #339933;">:</span> <span style="color: #CC0000;">20</span><span style="color: #339933;">,</span><br />
&nbsp; &nbsp; &nbsp; speed<span style="color: #339933;">:</span> <span style="color: #CC0000;">500</span><span style="color: #339933;">,</span><br />
&nbsp; &nbsp; &nbsp; reset<span style="color: #339933;">:</span> <span style="color: #CC0000;">100</span><span style="color: #339933;">,</span><br />
&nbsp; &nbsp; &nbsp; color<span style="color: #339933;">:</span> <span style="color: #3366CC;">'#000'</span><span style="color: #339933;">,</span><br />
&nbsp; &nbsp; &nbsp; easing<span style="color: #339933;">:</span> <span style="color: #3366CC;">'easeOutExpo'</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span> options<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">return</span> <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">each</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #003366; font-weight: bold;">var</span> nav <span style="color: #339933;">=</span> $<span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; currentPageItem <span style="color: #339933;">=</span> $<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'#selected'</span><span style="color: #339933;">,</span> nav<span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; glow<span style="color: #339933;">,</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; reset<span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; $<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'&lt;li id=&quot;glow&quot;&gt;&lt;/li&gt;'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">css</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; width<span style="color: #339933;">:</span> currentPageItem.<span style="color: #660066;">outerWidth</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; height<span style="color: #339933;">:</span> currentPageItem.<span style="color: #660066;">outerHeight</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; left<span style="color: #339933;">:</span> currentPageItem.<span style="color: #660066;">position</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">left</span><span style="color: #339933;">,</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; top<span style="color: #339933;">:</span> currentPageItem.<span style="color: #660066;">position</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">top</span><span style="color: #339933;">,</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; backgroundColor<span style="color: #339933;">:</span> options.<span style="color: #660066;">color</span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">appendTo</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'#nav'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; glow <span style="color: #339933;">=</span> $<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'#glow'</span><span style="color: #339933;">,</span> nav<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; $<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'li'</span><span style="color: #339933;">,</span> nav<span style="color: #009900;">&#41;</span>.<span style="color: #660066;">hover</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; clearTimeout<span style="color: #009900;">&#40;</span>reset<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; glow.<span style="color: #660066;">animate</span><span style="color: #009900;">&#40;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; left<span style="color: #339933;">:</span> $<span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">position</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">left</span><span style="color: #339933;">,</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; width<span style="color: #339933;">:</span> $<span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">width</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; duration<span style="color: #339933;">:</span> options.<span style="color: #660066;">speed</span><span style="color: #339933;">,</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; easing<span style="color: #339933;">:</span> options.<span style="color: #660066;">easing</span><span style="color: #339933;">,</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; queue<span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">false</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #006600; font-style: italic;">//mouse out</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; glow.<span style="color: #000066;">stop</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">animate</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; left<span style="color: #339933;">:</span> $<span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">position</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">left</span><span style="color: #339933;">,</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; width<span style="color: #339933;">:</span> $<span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">width</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span> options.<span style="color: #660066;">speed</span><span style="color: #009900;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; reset <span style="color: #339933;">=</span> setTimeout<span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; glow.<span style="color: #660066;">animate</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; width<span style="color: #339933;">:</span> currentPageItem.<span style="color: #660066;">outerWidth</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; left<span style="color: #339933;">:</span> currentPageItem.<span style="color: #660066;">position</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">left</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span> options.<span style="color: #660066;">speed</span><span style="color: #009900;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span> options.<span style="color: #660066;">reset</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; <span style="color: #009900;">&#125;</span><span style="color: #339933;">;</span><br />
<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#40;</span>jQuery<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></div></td></tr></tbody></table></div>
<p>The main differences between this and Jeff’s original code is that we aren’t creating the background with the slider using CSS, we’re using an image. And the slider isn’t bigger than the regular &lt;li&gt; tags.</p>
<p>And <a href="http://atomicrobotdesign.com/blog_media/green_nav.html">here&#8217;s what we get</a>.</p>
<p>This is a great effect that can be different every time and it’s pretty straight forward. And a nice bonus is that you can reuse the jQuery code every time because the main effects and styles are all set with CSS.</p>
]]></content:encoded>
			<wfw:commentRss>http://atomicrobotdesign.com/blog/htmlcss/glowing-nav-effect-using-jquery/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

