<?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>Call Me Goon &#187; Javascript</title>
	<atom:link href="http://callmegoon.com/category/javascript/feed/" rel="self" type="application/rss+xml" />
	<link>http://callmegoon.com</link>
	<description></description>
	<lastBuildDate>Wed, 12 Oct 2011 22:50:11 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>Create a fun, clean, easy to use FAQ list with jQuery!</title>
		<link>http://callmegoon.com/create-a-fun-clean-easy-to-use-faq-list/</link>
		<comments>http://callmegoon.com/create-a-fun-clean-easy-to-use-faq-list/#comments</comments>
		<pubDate>Tue, 29 Sep 2009 04:01:14 +0000</pubDate>
		<dc:creator>Goon</dc:creator>
				<category><![CDATA[HTML/CSS]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[HTML]]></category>
		<category><![CDATA[Tips]]></category>

		<guid isPermaLink="false">http://callmegoon.com/?p=906</guid>
		<description><![CDATA[This tutorial demonstrates how to create a jQuery FAQ list that is both easy to use and easy to create. View a real life example. FAQ pages are often a long list of questions followed by answers, or a list of questions that anchor link to an answer further down the page. Neither one creates [...]]]></description>
			<content:encoded><![CDATA[<img class="alignleft size-full wp-image-908" title="jQuery FAQ List" src="http://callmegoon.com/wp-content/uploads/2009/09/Featured-List.jpg" alt="jQuery FAQ List" width="143" height="125" />
<p>This tutorial demonstrates how to create a jQuery FAQ list that is both easy to use and easy to create.  <a class="newwindow" href="http://www.gatewaygi.com/faqs">View a real life example.</a></p>
<p>FAQ pages are often a long list of questions followed by answers, or a list of questions that anchor link to an answer further down the page.  Neither one creates a very usable way for users to easily find the information they are looking for.</p>
<p>The following script fixes all of that by creating a clean page that puts the user in control of what information to display.</p>

<object classid='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,115,0' width='560' height='345'><param name='movie' value='http://screenr.com/Content/assets/screenr_0817090731.swf' ></param><param name='flashvars' value='i=15231' ></param><param name='allowFullScreen' value='true' ></param><embed src='http://screenr.com/Content/assets/screenr_0817090731.swf' flashvars='i=15231' allowFullScreen='true' width='560' height='345' pluginspage='http://www.macromedia.com/go/getflashplayer' ></embed></object>

<h3>The HTML</h3>
<p>First we wrap everything in a wrapper div and give it a class name.  Within this div is an h5.  This h5 is actually our question.  It doesn't have to be an h5, but if you use a different element, you will have to edit the jQuery accordingly to target the element you have chosen to use.  Next, we have a div with a class of answer.  We will be targeting this div in order for the user to be able to show and hide the answer.  Within this div is a paragraph tag with some filler lorem ipsum text.</p>
<p>That is all you need to create the HTML for one question, however, to get the full effect, you will want to copy and past this code a few times so that  you have a few questions.</p>
<pre class="brush: xml; title: ; notranslate">
&amp;amp;lt;div class=&amp;amp;quot;FAQWrap&amp;amp;quot;&amp;amp;gt;
  &amp;amp;lt;h5&amp;amp;gt;This is my question?&amp;amp;lt;/h5&amp;amp;gt;
  &amp;amp;lt;div class=&amp;amp;quot;answer&amp;amp;quot;&amp;amp;gt;
    &amp;amp;lt;p&amp;amp;gt;Notare quam littera gothica quam, nunc putamus parum claram anteposuerit litterarum. Et quinta decima eodem modo typi qui nunc. Per seacula quarta decima nobis videntur parum clari: fiant sollemnes in.  Equitur mutationem consuetudium lectorum mirum est formas humanitatis.&amp;amp;lt;/p&amp;amp;gt;
    &amp;amp;lt;/div&amp;amp;gt;
  &amp;amp;lt;/div&amp;amp;gt;
</pre>

<h3>The CSS</h3>
<p>The styles are essentially unimportant.  You can styles the layout any way you want, but I will give some insight into some of the styles I often choose when creating an FAQ page.</p>
<p>The first thing to note is that I give my h5 a cursor: pointer style.  This creates the hand pointer when the user hovers on the question.  That gives the user a clear indication that something will happen if they click on this question.</p>
<p>You will also see that I have different background images for the h5 depending on whether it has a class of inactive or active.  We will change this class with jQuery when the user clicks the question and the class, along with the background image arrow, will toggle, again creating visual interactivity between the user and the page.</p>
<pre class="brush: css; title: ; notranslate">
#content {width: 960px; margin: 0 auto;}
.FAQWrap h5 {color: #555; margin: 10px 0 0 0; padding: 0 0 0 20px; font-size: 14px; font-weight: normal; cursor: pointer;}
.FAQWrap h5.inactive {background: url(../images/bg-faq-inactive.png) no-repeat 0 3px;}
.FAQWrap h5.active {background: url(../images/bg-faq-active.png) no-repeat 0 3px;}
.FAQWrap .answer {background: #EEE; margin: 10px 10px 20px 30px; padding: 10px;}
</pre>

<h3>The jQuery</h3>
<p>And finally, the most important part, the jQuery.  Remember of course to first link to the jQuery framework.</p>
<p>The first thing we do is hide all answer divs when the page loads.  That creates the nice clean layout we are looking for and puts the control in the hands of the user as which information they want displayed on the page.</p>
<p>Next, we target all h5's within the FAQWrap div and assign a class of inactive.  This, along with our CSS on the h5, will create a background image of an arrow pointing to the right, denoting that the answer is hidden, but can be displayed if you click the question.</p>
<p>The next thing we want to do is run a function when we click on an h5 within FAQWrap.  The first thing we do is use this toggleClass method to switch the class of the actual h5 we clicked.  toggleClass simply toggles the class name on the targeted element.  If it has a class of 'inactive', it will switch the class to 'active', and if it is 'active', it will switch the class to 'inactive'.   So, hopefully you are now beginning to see that each time we click on an h5, we are switching the class name between 'inactive' and 'active', and that, in combination with our CSS, is what is changing our background image arrow on the h5.</p>
<p>The last thing we do, which is most important, is slideToggle the answer div.  The way we do that is first find the parent of 'this' (the h5 we are clicking on), then we are finding the div with a class of answer within that parent element, and slideToggling it.  This means that if the answer is showing, it will slideUp and and be hidden, and if it is hidden, it will slideDown and show.</p>
<pre class="brush: jscript; title: ; notranslate">
$(function() {
      $('.answer').hide();
      $('.FAQWrap h5').addClass('inactive');
      $('.FAQWrap h5').click(function() {
        $(this).toggleClass('active');
        $(this).toggleClass('inactive');
        $(this).parent().find('.answer').slideToggle();        
      });
    });
</pre>

<h3>The Demo</h3>
<p>And so when you put all of that together, you get a nice, clean, easy to use FAQ page that any user will enjoy using!</p>
<style type="text/css" media="screen">
.FAQWrap h5 {color: #555; margin: 10px 0 0 0; padding: 0 0 0 20px; font-size: 14px; font-weight: normal; cursor: pointer;}
.FAQWrap h5.inactive {background: url(/wp-content/themes/simplebeginnings/images/bg-faq-inactive.png) no-repeat 0 3px;}
.FAQWrap h5.active {background: url(/wp-content/themes/simplebeginnings/images/bg-faq-active.png) no-repeat 0 3px;}
.FAQWrap .answer {background: #EEE; margin: 10px 10px 20px 30px; padding: 10px;}
</style>
<script type="text/javascript" charset="utf-8">
    $(function() {
      $('.answer').hide();
      $('.FAQWrap h5').addClass('inactive');
      $('.FAQWrap h5').click(function() {
        $(this).toggleClass('active');
        $(this).toggleClass('inactive');
        $(this).parent().find('.answer').slideToggle();        
      });
    });
  </script>
<div class="FAQWrap">
      <h5>This is my question?</h5>
      <div class="answer">
        <p>Notare quam littera gothica quam, nunc putamus parum claram anteposuerit litterarum. Et quinta decima eodem modo typi qui nunc. Per seacula quarta decima nobis videntur parum clari: fiant sollemnes in. Sequitur mutationem consuetudium lectorum mirum est formas humanitatis.</p>
      </div>
    </div>
    <div class="FAQWrap">
      <h5>This is my question?</h5>
      <div class="answer">
        <p>Notare quam littera gothica quam, nunc putamus parum claram anteposuerit litterarum. Et quinta decima eodem modo typi qui nunc. Per seacula quarta decima nobis videntur parum clari: fiant sollemnes in. Sequitur mutationem consuetudium lectorum mirum est formas humanitatis.</p>
      </div>
    </div>
    <div class="FAQWrap">
      <h5>This is my question?</h5>
      <div class="answer">
        <p>Notare quam littera gothica quam, nunc putamus parum claram anteposuerit litterarum. Et quinta decima eodem modo typi qui nunc. Per seacula quarta decima nobis videntur parum clari: fiant sollemnes in. Sequitur mutationem consuetudium lectorum mirum est formas humanitatis.</p>
      </div>
    </div>

<p class="source"><a href="/sourcefiles/FAQExample.zip">Download the source</a></p>
]]></content:encoded>
			<wfw:commentRss>http://callmegoon.com/create-a-fun-clean-easy-to-use-faq-list/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Simple jQuery Image Fade Slideshow</title>
		<link>http://callmegoon.com/jquery-image-fader/</link>
		<comments>http://callmegoon.com/jquery-image-fader/#comments</comments>
		<pubDate>Thu, 17 Sep 2009 05:10:06 +0000</pubDate>
		<dc:creator>Goon</dc:creator>
				<category><![CDATA[Javascript]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[Tips]]></category>

		<guid isPermaLink="false">http://callmegoon.com/?p=855</guid>
		<description><![CDATA[This tutorial demonstrates how to create a simple image fade slideshow using jquery. We will use a plugin called the jQuery Cycle Plugin to make achieving this effect easier. "The plugin provides a method called cycle which is invoked on a container element. Each child element of the container becomes a "slide". Options control how [...]]]></description>
			<content:encoded><![CDATA[<img class="alignleft size-full wp-image-856" title="jQuery Image Fader" src="http://callmegoon.com/wp-content/uploads/2009/09/jquery.jpg" alt="jQuery Image Fader" width="143" height="125" />

This tutorial demonstrates how to create a simple image fade slideshow using jquery.  We will use a plugin called the <a class="newwindow" href="http://malsup.com/jquery/cycle/">jQuery Cycle Plugin</a> to make achieving this effect easier.  "The plugin provides a method called cycle which is invoked on a container element. Each child element of the container becomes a "slide". Options control how and when the slides are transitioned."

There are numerous transitions besides just fade that can easily be implemented as well, including zoom, shuffle, turn down, etc.  It is actually quite simple to implement, just follow the steps below and you'll quickly be on your way.  You can also download the <a href="/sourcefiles/Image_Fader.zip">source files</a> as a quick an easy to dig into the code.
<h3>Demo:</h3>
<script src="http://callmegoon.com/wp-content/themes/simplebeginnings/js/imageCycle.js"></script>
 <script type="text/javascript">// <![CDATA[
$(function() {
if (!$('.pics').length > 0) return false;
$('.pics').cycle('fade');
});
// ]]&gt;</script>

<!-- .picsWrap {background: #eee; width: 230px; border: 1px solid #ddd;} img {border-bottom: 1px solid #fff;} .picsWrap p {padding: 10px; margin: 0;} -->
<div class="pics"><img src="/wp-content/themes/simplebeginnings/images/imagefader/1.png" alt="" width="205" height="147" />
<img src="/wp-content/themes/simplebeginnings/images/imagefader/2.jpg" alt="" width="205" height="147" />
<img src="/wp-content/themes/simplebeginnings/images/imagefader/3.jpg" alt="" width="205" height="147" />
<img src="/wp-content/themes/simplebeginnings/images/imagefader/4.jpg" alt="" width="205" height="147" /></div>
<!--end .pics-->
<h3>Code:</h3>
First, download the jquery framework.  You can grab that <a class="newwindow" href="http://code.google.com/p/jqueryjs/downloads/detail?name=jquery-1.3.1.min.js">here</a>.  Next, head over to the <a class="newwindow" href="http://malsup.com/jquery/cycle/">jQuery Cycle Plugin</a> page and download the image cycle javascript file.  Or you can download it directly <a class="newwindow" href="http://malsup.com/jquery/cycle/jquery.cycle.all.min.js?v2.71">here</a>.  You may have to copy the code from this page and save into a file, I called mine imageCycle.js.

Next, create a new file called index.html.  Within index.html, you need to call a couple javascript files, both jquery.js and the imageCycle.js we just downloaded.  We also need to create a function to initiate the cycle plugin on a specific html element.

<pre class="brush: jscript; title: ; notranslate">
&lt;script src=&quot;/js/jquery.min.js&quot;&gt;&lt;/script&gt;
&lt;script src=&quot;/js/imageCycle.js&quot;&gt;&lt;/script&gt;
&lt;script type=&quot;text/javascript&quot;&gt;
$(function() {
if (!$('.pics').length &gt; 0) return false;
$('.pics').cycle('fade');
});
&lt;/script&gt;
</pre>

For the HTML, I will create a div with a class of 'pics'.  Within that div are simple img elements.  The class of pics on our div is the trigger from our jquery function that creates that image rotation on all the img elements within our div.

<pre class="brush: xml; title: ; notranslate">
&lt;div class=&quot;pics&quot;&gt;
  	&lt;img src=&quot;images/1.png&quot; width=&quot;205&quot; height=&quot;147&quot; alt=&quot;&quot; title=&quot;&quot; /&gt;
  	&lt;img src=&quot;images/2.jpg&quot; width=&quot;205&quot; height=&quot;147&quot; alt=&quot;&quot; title=&quot;&quot; /&gt;
  	&lt;img src=&quot;images/3.jpg&quot; width=&quot;205&quot; height=&quot;147&quot; alt=&quot;&quot; title=&quot;&quot; /&gt;
  	&lt;img src=&quot;images/4.jpg&quot; width=&quot;205&quot; height=&quot;147&quot; alt=&quot;&quot; title=&quot;&quot; /&gt;
  &lt;/div&gt;&lt;!--end .pics--&gt;
</pre>

It's really as simple as that.
<ol>
	<li>link to the jquery framework</li>
	<li>link to the image cycle jquery plugin</li>
	<li>create a function that links to a specific class to trigger the rotation (just copy the exact function I have included)</li>
	<li>create a div with a class of 'pics' (or whatever trigger you chose to use in your function.  If you just copied mine, it will be 'pics').</li>
	<li>include the images with your div that you would like to fade in and out</li>
</ol>
You can always add your own custom styles to spice things up a bit if necessary, but I tried to keep this as simple as possible.  Be sure to head over the <a class="newwindow" href="http://malsup.com/jquery/cycle/">jQuery Cycle Plugin</a> page for even more features and image fade possibilities.
<p class="source"><a href="/sourcefiles/Image_Fader.zip">Download Source</a></p>]]></content:encoded>
			<wfw:commentRss>http://callmegoon.com/jquery-image-fader/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Cufon &#8211; The Best Font Replacement Tool</title>
		<link>http://callmegoon.com/cufon-the-best-font-replacement-tool/</link>
		<comments>http://callmegoon.com/cufon-the-best-font-replacement-tool/#comments</comments>
		<pubDate>Thu, 30 Jul 2009 22:19:59 +0000</pubDate>
		<dc:creator>Goon</dc:creator>
				<category><![CDATA[Fonts]]></category>
		<category><![CDATA[HTML/CSS]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[jQuery]]></category>

		<guid isPermaLink="false">http://callmegoon.com/?p=654</guid>
		<description><![CDATA[Description: This page demonstrates the easiest way to do font replacement on the web. Get up and running in just a matter of a few minutes. This is a fairly brief and basic overview, but I am thinking that anyone trying to use this technique will have a basic understanding of how to manage the [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://callmegoon.com/wp-content/uploads/2009/07/cufon.jpg" alt="cufon" title="cufon" width="143" height="125" class="alignleft size-full wp-image-667 left" /><br />
<h3>Description:</h3>
<p>This page demonstrates the easiest way to do font replacement on the web.  Get up and running in just a matter of a few minutes. This is a fairly brief and basic overview, but I am thinking that anyone trying to use this technique will have a basic understanding of how to manage the various files.  But be sure to ask questions if anything is unclear, I promise it's not hard and anyone can do it, finally!</p>
<p>Until we are able to use the CSS3 @font-face property, we are stuck using 'hacks' to load styled fonts without creating background images manually.  While many of these can be a major pain (cough-sifr), Cufon makes it super easy.</p>
<ol>
<li><a class="newwindow" href="http://cufon.shoqolate.com/generate/">Download Cufon</a> and call it in your html file.<br /><pre class="brush: jscript; title: ; notranslate">&lt;script type=&quot;text/javascript&quot; src=&quot;cufon.js&quot;&gt;&lt;/script&gt;</pre></li>
<li><a class="newwindow" href="http://cufon.shoqolate.com/generate/">Select the font</a> you would like to use by browsing to it on your computer through Cufon's web interface.</li>
<li>Be sure to make sure that you are allowed to freely use the font you are using and check the 'EULA' checkbox.</li>
<li>Select the different glyphs you want to use.  You are probably fine just using uppercase, lowercase, numerals, punctuation, and maybe wordpress punctuation if you want.</li>
<li>Type in your domain so this file can only be used with your domain.  This is a good security measure to prevent people from hotlinking your fonts.</li>
<li>You can play with the other settings but they are usually just fine so just check the 'accept terms' checkbox and download the javascript file for your font.</li>
<li>A javascript file will be downloaded with the necessary information to use this font, so be sure to call to this file in your html as well.
<pre class="brush: jscript; title: ; notranslate">&lt;script type=&quot;text/javascript&quot; src=&quot;Apple_Casual_400.font.js&quot;&gt;&lt;/script&gt;</pre>
</li>
<li>Load the cufon script that calls a specific element.<br />
<pre class="brush: jscript; title: ; notranslate">
&lt;script type=&quot;text/javascript&quot;&gt;
  Cufon.replace('h2');
&lt;/script&gt;
</pre><br />
In this example, all H2s in our page will be display our stylized font (see demo below).
</li>
</ol>
<h3>Demo:</h3>
<p><script type="text/javascript" src="/wp-content/themes/simplebeginnings/js/cufon.js"></script>
	<script type="text/javascript" src="/wp-content/themes/simplebeginnings/js/Apple_Casual_400.font.js"></script>
<script type="text/javascript">
  	Cufon.replace('.cufon');
  </script></p>
<h1 class="cufon">This is an H1 with font replacement.</h1>
<h2>This is an H2 without font replacement.</h2>
<p class="cufon">This is a paragraph with font replacement.</p>
<h3>Important Notes:</h3>
<ul>
<li>This is javascript based so it will not work if the user has turned off javascript for some reason.</li>
<li>You cannot add a css hover state to the focused element so this would not be a good solution for links that you want to change color on hover for instance.</li>
<li>Unfortunately the text is NOT selectable (one of the pluses of sifr).</li>
<li>In its out of the box form, you cannot target specific elements using selectors so you will need to load a javascript framework to handle that.  I highly recommend jquery.  Just load jQuery BEFORE you load cufon, and then you can target elements with css selectors.    </li>
</ul>
      <pre class="brush: jscript; title: ; notranslate">
        &lt;script type=&quot;text/javascript&quot; src=&quot;jquery-1.3.2.min.js&quot;&gt;&lt;/script&gt;
      </pre>
      I have noticed that it is nice to just have cufon replace text on any element with the class of "cufon", then you can just add that class to whatever elements you would like to target for font replacement.


So in the end, your &lt;head&gt; should end up looking something this:
    <pre class="brush: xml; title: ; notranslate">
      &lt;head&gt;
      	&lt;meta http-equiv=&quot;Content-Type&quot; content=&quot;text/html; charset=utf-8&quot;/&gt;
      	&lt;script type=&quot;text/javascript&quot; src=&quot;jquery-1.3.2.min.js&quot;&gt;&lt;/script&gt;
      	&lt;script type=&quot;text/javascript&quot; src=&quot;cufon.js&quot;&gt;&lt;/script&gt;
      	&lt;script type=&quot;text/javascript&quot; src=&quot;Apple_Casual_400.font.js&quot;&gt;&lt;/script&gt;
      	&lt;script type=&quot;text/javascript&quot;&gt;
             Cufon.replace('.cufon');
        &lt;/script&gt;
      	&lt;title&gt;Font Replacement - The Easy Way&lt;/title&gt;
      &lt;/head&gt;
    </pre><br />
    In this case, I am targeting all elements with the class of cufon and replacing its font-face with my stylized font.
  </p>
<br />
<p class="source"><a href="/sourcefiles/Cufon.zip">Download full sources files!</a></p>
]]></content:encoded>
			<wfw:commentRss>http://callmegoon.com/cufon-the-best-font-replacement-tool/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

