<?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>Jendro Design &#187; Code</title>
	<atom:link href="http://jendrodesign.com/blog/category/code/feed/" rel="self" type="application/rss+xml" />
	<link>http://jendrodesign.com/blog</link>
	<description>Web Design &#124; Huntsville, AL</description>
	<lastBuildDate>Wed, 26 Aug 2009 12:12:13 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.4</generator>
		<item>
		<title>CSS Resets</title>
		<link>http://jendrodesign.com/blog/2009/07/css-resets/</link>
		<comments>http://jendrodesign.com/blog/2009/07/css-resets/#comments</comments>
		<pubDate>Thu, 09 Jul 2009 18:49:17 +0000</pubDate>
		<dc:creator>Jason</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[Compatiblity]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[Standards]]></category>

		<guid isPermaLink="false">http://jendrodesign.com/blog/?p=149</guid>
		<description><![CDATA[When designing XHTML and CSS it is important to be cognoscente of the fact that every browser will interpret your code a little bit differently. This mostly has to do with the default styling, padding, and margin of different elements as determined by a particular browser. While your page may look generally the same in [...]]]></description>
			<content:encoded><![CDATA[<p>When designing XHTML and CSS it is important to be cognoscente of the fact that every browser will interpret your code a little bit differently. This mostly has to do with the default styling, padding, and margin of different elements as determined by a particular browser. While your page may look generally the same in all browsers, if you look closely, there is a good chance that you can catch the minor differences in presentation. Most of the time it is readily evident if you develop a site in one browser (Firefox) and then proof it in another (IE). The margin and padding of commonly used tags such as &lt;h1&gt; and &lt;p&gt; will most likely be slightly different, resulting in minor presentation deviations that drive us crazy. So what&#8217;s the simplest solution?</p>
<p><span id="more-149"></span></p>
<h3>Introducing: The CSS Reset</h3>
<p>The concept behind a CSS reset is to have a standard set of code that you can declare at the beginning of a stylesheet that intentionally eliminates those minor browser differences. After the reset declaration, you may style the various elements of your stylesheet as you usually do. There are <a href="http://www.christianmontoya.com/2007/02/01/css-techniques-i-use-all-the-time/">numerous</a> <a href="http://meyerweb.com/eric/thoughts/2007/05/01/reset-reloaded/">iterations</a> on the <a href="http://www.smashingmagazine.com/2007/09/21/css-frameworks-css-reset-design-from-scratch/">subject</a> that we could debate ad infinitum. So, I will simply show you the one that works for me.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
</pre></td><td class="code"><pre class="css" style="font-family:monospace;"><span style="color: #808080; font-style: italic;">/* Zero Out */</span>
&nbsp;
h1<span style="color: #00AA00;">,</span> h2<span style="color: #00AA00;">,</span> h3<span style="color: #00AA00;">,</span> h4<span style="color: #00AA00;">,</span> h5<span style="color: #00AA00;">,</span> h6<span style="color: #00AA00;">,</span> ul<span style="color: #00AA00;">,</span> ol<span style="color: #00AA00;">,</span> li<span style="color: #00AA00;">,</span> em<span style="color: #00AA00;">,</span> strong<span style="color: #00AA00;">,</span> pre<span style="color: #00AA00;">,</span> code<span style="color: #00AA00;">,</span> blockquote<span style="color: #00AA00;">,</span> form<span style="color: #00AA00;">,</span> img <span style="color: #00AA00;">&#123;</span>
	<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>
	<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>
        <span style="color: #000000; font-weight: bold;">border</span><span style="color: #00AA00;">:</span> <span style="color: #cc66cc;">0</span><span style="color: #00AA00;">;</span>
        <span style="color: #000000; font-weight: bold;">outline</span><span style="color: #00AA00;">:</span> <span style="color: #cc66cc;">0</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">font-size</span><span style="color: #00AA00;">:</span> <span style="color: #933;">100%</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">font-weight</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">normal</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">font-style</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">normal</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">font-family</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">inherit</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span>
table <span style="color: #00AA00;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">border-collapse</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">separate</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">border-spacing</span><span style="color: #00AA00;">:</span> <span style="color: #cc66cc;">0</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">font-size</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">inherit</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span>
img a <span style="color: #00AA00;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">border</span><span style="color: #00AA00;">:</span> <span style="color: #933;">0px</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">background</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">none</span><span style="color: #00AA00;">;</span>	
<span style="color: #00AA00;">&#125;</span>
p <span style="color: #00AA00;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">margin</span><span style="color: #00AA00;">:</span> <span style="color: #933;">1em</span> <span style="color: #933;">0px</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span></pre></td></tr></table></div>

<h3>Notes</h3>
<p>Keep in mind, this is what works for me. Everyone writes CSS differently so the possibilities are endless here. You have the potential to get very detailed with the CSS reset technique and reset <em>everything</em>. This can erase a lot of default styles that you&#8217;ve gotten used to using and expect to just magically be there. I have intentionally eliminated many tags and selectors that I virtually never use. I don&#8217;t see a point in including them in my generic reset code. If you find yourself using a particular set of tags more often then I do, by all means add them to your reset code. I tend to style tags such as &lt;body&gt; and &lt;a&gt; very differently from site to site so I do not include them in the reset.</p>
<p>The key here is to experiment. Develop a CSS reset tailored to your coding tendencies and the features the site demands. It will make ironing out the &#8220;why does my site look different in&#8230;?&#8221; issues down the road much easier.</p>
]]></content:encoded>
			<wfw:commentRss>http://jendrodesign.com/blog/2009/07/css-resets/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Reusable Jquery Toggle</title>
		<link>http://jendrodesign.com/blog/2009/07/reusable-jquery-toggle/</link>
		<comments>http://jendrodesign.com/blog/2009/07/reusable-jquery-toggle/#comments</comments>
		<pubDate>Thu, 02 Jul 2009 16:19:26 +0000</pubDate>
		<dc:creator>Jason</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[Freebie]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[Jquery]]></category>

		<guid isPermaLink="false">http://jendrodesign.com/blog/?p=123</guid>
		<description><![CDATA[Jquery is a great tool. If you&#8217;re anything like me, learning JavaScript and getting it to do what you want is one of the most frustrating tasks imaginable. Jquery simplifies it to the point where you don&#8217;t have to be a coding God to make it do cool things for you. Here I share with [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://jquery.com">Jquery</a> is a great tool. If you&#8217;re anything like me, learning JavaScript and getting it to do what you want is one of the most frustrating tasks imaginable. Jquery simplifies it to the point where you don&#8217;t have to be a coding God to make it do cool things for you. Here I share with you my reusable toggle script that hides content you wish to be hidden, then shows it by clicking a link, and then hides it again by clicking the link one more time. It is useful for many applications.</p>
<p><span id="more-123"></span></p>
<h3>The Code</h3>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
</pre></td><td class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #006600; font-style: italic;">//&lt;![CDATA[    </span>
   <span style="color: #006600; font-style: italic;">// START ready function</span>
   $<span style="color: #009900;">&#40;</span>document<span style="color: #009900;">&#41;</span>.<span style="color: #660066;">ready</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>
&nbsp;
	<span style="color: #006600; font-style: italic;">// TOGGLE SCRIPT</span>
	$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;.hide&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">hide</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
	$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;a.toggle&quot;</span><span style="color: #009900;">&#41;</span>.<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>event<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</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;">parents</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;.article&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">find</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;.hide&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">toggle</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;normal&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
		<span style="color: #006600; font-style: italic;">// Stop the link click from doing its normal thing</span>
		<span style="color: #000066; font-weight: bold;">return</span> <span style="color: #003366; font-weight: bold;">false</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #006600; font-style: italic;">// END TOGGLE</span>
&nbsp;
   <span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #006600; font-style: italic;">// END ready function</span>
 <span style="color: #006600; font-style: italic;">//]]&gt;</span></pre></td></tr></table></div>

<h3>Using the Script</h3>
<ol>
<li>Copy and paste the script into a new javascript.js file, name of your choice.</li>
<li><a href="http://docs.jquery.com/Downloading_jQuery">Download</a> the latest Jquery minified build.</li>
<li>Link to both of these .js files within the &lt;head&gt; tag of your site like this:

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
</pre></td><td class="code"><pre class="html4strict" style="font-family:monospace;"><span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">script</span> <span style="color: #000066;">src</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;jquery-1.3.1.min.js&quot;</span> <span style="color: #000066;">type</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;text/javascript&quot;</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">script</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">script</span> <span style="color: #000066;">src</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;script.js&quot;</span> <span style="color: #000066;">type</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;text/javascript&quot;</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">script</span>&gt;</span></pre></td></tr></table></div>

</li>
<li>You&#8217;re done! Now follow the instructions on how to set up your XHTML to use the code.</li>
</ol>
<h3>Setting up the XHTML Markup</h3>
<p>Now all you need to do is set up your markup like this:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
</pre></td><td class="code"><pre class="html4strict" style="font-family:monospace;"><span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">div</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;article&quot;</span>&gt;</span>
   <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">a</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;toggle&quot;</span> <span style="color: #000066;">href</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;#&quot;</span>&gt;</span>Toggle This »<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">a</span>&gt;</span>
   <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">div</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;hide&quot;</span>&gt;</span>
      <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">p</span>&gt;</span>Hidden toggle content goes here<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">p</span>&gt;</span>
   <span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">div</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">div</span>&gt;</span></pre></td></tr></table></div>

<p>So here&#8217;s what you do: encase the whole shebang in a &lt;div&gt; with the class of &#8220;article.&#8221; You can change this class name if you want by changing the script.js you&#8217;ve created, but article works for me. Next include the toggle link. This link will display the hidden content inside the &lt;div class=&#8221;hide&#8221;&gt; that Jquery hid automatically for you upon page load. Click the link again and it is hidden again. Hence, toggle.</p>
<p>Here&#8217;s what happens: When the toggle link is clicked, Jquery then looks for the &lt;div&gt; with the class of &#8220;hide&#8221; that is within the &lt;div&gt; with the class of &#8220;article&#8221; that the toggle link also happens to be within. Therefore, you can reuse this markup as many times as you want without adjusting the script.</p>
<h3>Examples</h3>
<p>This markup:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
</pre></td><td class="code"><pre class="html4strict" style="font-family:monospace;"><span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">div</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;article&quot;</span>&gt;</span>
   <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">a</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;toggle&quot;</span> <span style="color: #000066;">href</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;#&quot;</span>&gt;</span>Toggle 1 »<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">a</span>&gt;</span>
   <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">div</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;hide&quot;</span>&gt;</span>
      <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">p</span>&gt;</span>Hidden toggle content 1.<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">p</span>&gt;</span>
   <span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">div</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">div</span>&gt;</span>
&nbsp;
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">div</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;article&quot;</span>&gt;</span>
   <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">a</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;toggle&quot;</span> <span style="color: #000066;">href</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;#&quot;</span>&gt;</span>Toggle 2 »<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">a</span>&gt;</span>
   <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">div</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;hide&quot;</span>&gt;</span>
      <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">p</span>&gt;</span>Hidden toggle content 2.<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">p</span>&gt;</span>
   <span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">div</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">div</span>&gt;</span>
&nbsp;
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">div</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;article&quot;</span>&gt;</span>
   <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">a</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;toggle&quot;</span> <span style="color: #000066;">href</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;#&quot;</span>&gt;</span>Toggle 3 »<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">a</span>&gt;</span>
   <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">div</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;hide&quot;</span>&gt;</span>
      <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">p</span>&gt;</span>Hidden toggle content 3.<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">p</span>&gt;</span>
   <span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">div</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">div</span>&gt;</span></pre></td></tr></table></div>

<p>Produces:</p>
<div class="article">
   <a class="toggle" href="#">Toggle 1 »</a></p>
<div class="hide">
<p>Hidden toggle content 1.</p>
</p></div>
</div>
<div class="article">
   <a class="toggle" href="#">Toggle 2 »</a></p>
<div class="hide">
<p>Hidden toggle content 2.</p>
</p></div>
</div>
<div class="article">
   <a class="toggle" href="#">Toggle 3 »</a></p>
<div class="hide">
<p>Hidden toggle content 3.</p>
</p></div>
</div>
<p>I hope you enjoy.</p>
]]></content:encoded>
			<wfw:commentRss>http://jendrodesign.com/blog/2009/07/reusable-jquery-toggle/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
	</channel>
</rss>

