<?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>scriptygoddess &#187; Javascript</title>
	<atom:link href="http://www.scriptygoddess.com/archives/category/javascript/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.scriptygoddess.com</link>
	<description></description>
	<lastBuildDate>Thu, 08 Dec 2011 18:23:44 +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>Embed a vimeo video using swfobject and setting the audio to mute</title>
		<link>http://www.scriptygoddess.com/archives/2011/08/29/embed-a-vimeo-video-using-swfobject-and-setting-the-audio-to-mute/</link>
		<comments>http://www.scriptygoddess.com/archives/2011/08/29/embed-a-vimeo-video-using-swfobject-and-setting-the-audio-to-mute/#comments</comments>
		<pubDate>Tue, 30 Aug 2011 03:39:22 +0000</pubDate>
		<dc:creator>Jennifer</dc:creator>
				<category><![CDATA[Javascript]]></category>
		<category><![CDATA[Video]]></category>

		<guid isPermaLink="false">http://www.scriptygoddess.com/?p=1691</guid>
		<description><![CDATA[Not too much to explain here &#8211; wanted to embed a vimeo video, and wanted it to autoplay, but wanted the volume set to mute to start&#8230; &#60;div id="myvideo"&#62;&#60;/div&#62; &#60;script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/swfobject/2.2/swfobject.js"&#62;&#60;/script&#62; &#60;script type="text/javascript"&#62; function vimeo_player_loaded() { moogaloop3 = document.getElementById('myvideo'); moogaloop3.api_setVolume(0); } var flashvars = { 'clip_id': '29950141', 'server': 'vimeo.com', 'show_title': 0, 'show_byline': 0, 'show_portrait': [...]
No related posts.

Related posts brought to you by <a href='http://yarpp.org'>Yet Another Related Posts Plugin</a>.]]></description>
			<content:encoded><![CDATA[<p>Not too much to explain here &#8211; wanted to embed a vimeo video, and wanted it to autoplay, but wanted the volume set to mute to start&#8230;<br />
<code>&lt;div id="myvideo"&gt;&lt;/div&gt;<br />
&lt;script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/swfobject/2.2/swfobject.js"&gt;&lt;/script&gt;<br />
&lt;script type="text/javascript"&gt;<br />
function vimeo_player_loaded() {<br />
moogaloop3 = document.getElementById('myvideo');<br />
moogaloop3.api_setVolume(0);<br />
}<br />
var flashvars = {<br />
'clip_id': '<strong>29950141</strong>',<br />
'server': 'vimeo.com',<br />
'show_title': 0,<br />
'show_byline': 0,<br />
'show_portrait': 0,<br />
'fullscreen': 0,<br />
'autoplay': 1,<br />
'js_api': 1,<br />
'js_onload': 'vimeo_player_loaded'<br />
}<br />
var parObj = {<br />
'swliveconnect':true,<br />
'fullscreen': 1,<br />
'allowscriptaccess': 'always',<br />
'allowfullscreen':true<br />
};<br />
var attObj = {}<br />
attObj.id="myvideo";<br />
swfobject.embedSWF("http://www.vimeo.com/moogaloop.swf", "myvideo", "<strong>343</strong>", "<strong>193</strong>", "9.0.28", '',flashvars,parObj, attObj );<br />
&lt;/script&gt;</code></p>
<p>I actually just dropped this block right into a text widget in WordPress and it worked just fine&#8230;</p>
<p>The &#034;29950141&#034; is the video id (you can extract that from the URL you&#039;d normally use to embed your vimeo video with)</p>
<p>The &#034;343&#034; and &#034;193&#034; are the width and height of the video we&#039;re displaying.</p>
<p>No related posts.</p>
<p>Related posts brought to you by <a href='http://yarpp.org'>Yet Another Related Posts Plugin</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://www.scriptygoddess.com/archives/2011/08/29/embed-a-vimeo-video-using-swfobject-and-setting-the-audio-to-mute/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>launch all external links in a new window with jQuery</title>
		<link>http://www.scriptygoddess.com/archives/2011/04/06/launch-all-external-links-in-a-new-window-with-jquery/</link>
		<comments>http://www.scriptygoddess.com/archives/2011/04/06/launch-all-external-links-in-a-new-window-with-jquery/#comments</comments>
		<pubDate>Wed, 06 Apr 2011 19:38:39 +0000</pubDate>
		<dc:creator>Jennifer</dc:creator>
				<category><![CDATA[Javascript]]></category>
		<category><![CDATA[jquery]]></category>

		<guid isPermaLink="false">http://www.scriptygoddess.com/?p=1669</guid>
		<description><![CDATA[This is a really simple piece of jquery that will launch all external links on the page in a new window. jQuery(document).ready(function(){ jQuery("a[href*='http://']:not([href*='http://yourdomain.com'])").attr("target","_blank"); jQuery("a[href*='https://']:not([href*='https://yourdomain.com'])").attr("target","_blank"); }); Updated to add: Here is a modification in case you want to allow links to subdomains to open in the same window&#8230; jQuery("a[href*='http://']:not([href*='http://yourdomain.com'])").not("[href^='http://subdomain.yourdomain.com']").attr("target","_blank"); Another update Here is another modification that [...]
Related posts:<ol>
<li><a href='http://www.scriptygoddess.com/archives/2011/02/09/wordpress-emails-being-sent-by-usernamebox-bluehost-com-fix/' rel='bookmark' title='WordPress emails being sent by {username}@box###.bluehost.com (fix)'>WordPress emails being sent by {username}@box###.bluehost.com (fix)</a> <small>If you are hosted on Bluehost and you&#039;re using WordPress,...</small></li>
</ol>

Related posts brought to you by <a href='http://yarpp.org'>Yet Another Related Posts Plugin</a>.]]></description>
			<content:encoded><![CDATA[<p>This is a really simple piece of jquery that will launch all external links on the page in a new window. </p>
<p><code>jQuery(document).ready(function(){<br />
jQuery("a[href*='http://']:not([href*='http://yourdomain.com'])").attr("target","_blank");<br />
jQuery("a[href*='https://']:not([href*='https://yourdomain.com'])").attr("target","_blank");<br />
}); </code></p>
<p><strong>Updated to add:</strong> Here is a modification in case you want to allow links to subdomains to open in the same window&#8230;</p>
<p><code>jQuery("a[href*='http://']:not([href*='http://yourdomain.com'])").not("[href^='http://subdomain.yourdomain.com']").attr("target","_blank");</code></p>
<p><strong>Another update</strong> Here is another modification that will work in a PHP page and automatically enter the current domain in:</p>
<p><code>jQuery(document).ready(function(){<br />
jQuery("a[href*='http://']:not([href*='http://&lt;?php echo $_SERVER['HTTP_HOST']; ?&gt;'])").attr("target","_blank");<br />
jQuery("a[href*='https://']:not([href*='https://&lt;?php echo $_SERVER['HTTP_HOST']; ?&gt;'])").attr("target","_blank");<br />
});</code></p>
<p>Related posts:<ol>
<li><a href='http://www.scriptygoddess.com/archives/2011/02/09/wordpress-emails-being-sent-by-usernamebox-bluehost-com-fix/' rel='bookmark' title='WordPress emails being sent by {username}@box###.bluehost.com (fix)'>WordPress emails being sent by {username}@box###.bluehost.com (fix)</a> <small>If you are hosted on Bluehost and you&#039;re using WordPress,...</small></li>
</ol></p>
<p>Related posts brought to you by <a href='http://yarpp.org'>Yet Another Related Posts Plugin</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://www.scriptygoddess.com/archives/2011/04/06/launch-all-external-links-in-a-new-window-with-jquery/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Building Ajax Solutions With Usability And Accessibility</title>
		<link>http://www.scriptygoddess.com/archives/2010/10/18/building-ajax-solutions-with-usability-and-accessibility/</link>
		<comments>http://www.scriptygoddess.com/archives/2010/10/18/building-ajax-solutions-with-usability-and-accessibility/#comments</comments>
		<pubDate>Mon, 18 Oct 2010 14:57:48 +0000</pubDate>
		<dc:creator>Jennifer</dc:creator>
				<category><![CDATA[Javascript]]></category>

		<guid isPermaLink="false">http://www.scriptygoddess.com/?p=1650</guid>
		<description><![CDATA[By Guest Author: James Mowery With the explosion of web usage over the past decade, the online applications that users have access to have become more sophisticated as each year passes. While &#039;internet time&#039; is even faster than the proverbial &#039;dog years&#039;, one recent development has radically altered online applications and will continue to do [...]
No related posts.

Related posts brought to you by <a href='http://yarpp.org'>Yet Another Related Posts Plugin</a>.]]></description>
			<content:encoded><![CDATA[<p><strong>By Guest Author: James Mowery</strong></p>
<p>With the explosion of web usage over the past decade, the online applications that users have access to have become more sophisticated as each year passes. While &#039;internet time&#039; is even faster than the proverbial &#039;dog years&#039;, one recent development has radically altered online applications and will continue to do so for some time.</p>
<p>Dubbed &#039;Ajax&#039;, this technology allows for a web application to make asynchronous method calls to perform certain tasks without refreshing the user&#039;s browser. To the user, it may appear that the page changes as they use it, or there may be progress indicators such as &#039;loading&#039; graphics or something similar.</p>
<p>While the technology that allows this to occur isn&#039;t actually new, the availability and ubiquity of broadband internet access, along with wider browser support for advanced Javascript programming, has made it extremely common. Here are some specific points that anyone looking into creating Ajax-enabled applications to make sure they aren&#039;t just introducing something that happens to be the latest fad.</p>
<p>First, consider how many times your users may have to do something in the application, for example, clicking a button, which normally may cause the entire page to reload. By working to limit those types of actions to Ajax methods, the user&#039;s navigation experience will seem faster, as they don&#039;t have to wait for the page to refresh.</p>
<p>Sure, there is still some time for the page to update, but showing the user a progress bar or some other similar indicator makes the time seem quicker. It should also be noted that Ajax methods that update small parts of the web page should not just seem faster, however. Since less data is being passed back and forth across the wire to the user&#039;s browser, it will actually increase the application&#039;s speed.</p>
<p>Consider, however, being careful that trying to do everything in the application within a single screen may not be the best way to go, either. Some screens simply need a different layout in order to make sense to the user. By carefully deciding which navigation elements should be moved to Ajax and which should not, you will improves the accessibility and usability of the entire application.</p>
<p><em>About the author: James Mowery is a computer geek that writes about technology and related topics. To read more blog posts by him, go to <a href="http://www.laptopcomputers.org">laptop computers</a>.</em></p>
<p>No related posts.</p>
<p>Related posts brought to you by <a href='http://yarpp.org'>Yet Another Related Posts Plugin</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://www.scriptygoddess.com/archives/2010/10/18/building-ajax-solutions-with-usability-and-accessibility/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>swfobject &#8211; flash doesn&#039;t load in Firefox</title>
		<link>http://www.scriptygoddess.com/archives/2009/12/16/swfobject-flash-doesnt-load-in-firefox/</link>
		<comments>http://www.scriptygoddess.com/archives/2009/12/16/swfobject-flash-doesnt-load-in-firefox/#comments</comments>
		<pubDate>Wed, 16 Dec 2009 18:17:43 +0000</pubDate>
		<dc:creator>Jennifer</dc:creator>
				<category><![CDATA[Flash]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[Lessons learned]]></category>

		<guid isPermaLink="false">http://www.scriptygoddess.com/?p=1627</guid>
		<description><![CDATA[Ran into a bizarre problem today using swfobject. A lot of wasted time, but I&#039;ll give you the short story / solution. I&#039;m not sure of what other factors played a role (the fact that the element was in a absolute positioned container, or that the immediate container to the flash element was in a [...]
No related posts.

Related posts brought to you by <a href='http://yarpp.org'>Yet Another Related Posts Plugin</a>.]]></description>
			<content:encoded><![CDATA[<p>Ran into a bizarre problem today using <a href="http://code.google.com/p/swfobject/">swfobject</a>. A lot of wasted time, but I&#039;ll give you the short story / solution.</p>
<p>I&#039;m not sure of what other factors played a role (the fact that the element was in a absolute positioned container, or that the immediate container to the flash element was in a float) but I had the call to the swfobject javascript in the BODY tags of the html (not within the head tags). This was apparently causing Firefox to not display the flash. Simply moving the swfobject javascript code within the head tags of the html instantly fixed the problem.</p>
<p>I know I&#039;ve used swfobject inside the body before &#8211; so I&#039;m sure there&#039;s something else that contributed to the problem.</p>
<p>No related posts.</p>
<p>Related posts brought to you by <a href='http://yarpp.org'>Yet Another Related Posts Plugin</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://www.scriptygoddess.com/archives/2009/12/16/swfobject-flash-doesnt-load-in-firefox/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Adding alternate row styles to a table with JQuery</title>
		<link>http://www.scriptygoddess.com/archives/2009/08/08/adding-alternate-row-styles-to-a-table-with-jquery/</link>
		<comments>http://www.scriptygoddess.com/archives/2009/08/08/adding-alternate-row-styles-to-a-table-with-jquery/#comments</comments>
		<pubDate>Sun, 09 Aug 2009 01:24:44 +0000</pubDate>
		<dc:creator>Jennifer</dc:creator>
				<category><![CDATA[jquery]]></category>

		<guid isPermaLink="false">http://www.scriptygoddess.com/?p=1611</guid>
		<description><![CDATA[JQuery&#039;s simplicity is so wonderful and powerful. Here&#039;s a perfect example. If you have a table, and you want to alternate the row colors. To do so, all you need is this: $(document).ready(function() { $("table.striped tr:nth-child(even)").addClass("altrow"); }); Then, just add class=&#034;striped&#034; to your table tag, and jquery will automatically apply add the class &#034;altrow&#034; to [...]
No related posts.

Related posts brought to you by <a href='http://yarpp.org'>Yet Another Related Posts Plugin</a>.]]></description>
			<content:encoded><![CDATA[<p>JQuery&#039;s simplicity is so wonderful and powerful. Here&#039;s a perfect example. If you have a table, and you want to alternate the row colors. To do so, all you need is this:</p>
<p><code>$(document).ready(function() {<br />
	$("table.striped tr:nth-child(even)").addClass("altrow");<br />
});</code></p>
<p>Then, just add class=&#034;striped&#034; to your table tag, and jquery will automatically apply add the class &#034;altrow&#034; to every other row. (If you want to change which row it starts with &#8211; change &#039;even&#039; to &#039;odd&#039; in the code above).</p>
<p>Then just include a style for your altrow:</p>
<p><code>table.striped tr.altrow td {<br />
background-color: #ccc;<br />
}</code></p>
<p>And to think I used to do that manually. OY!</p>
<p>No related posts.</p>
<p>Related posts brought to you by <a href='http://yarpp.org'>Yet Another Related Posts Plugin</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://www.scriptygoddess.com/archives/2009/08/08/adding-alternate-row-styles-to-a-table-with-jquery/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Multi-Row Carousel and Image Loader with JQuery</title>
		<link>http://www.scriptygoddess.com/archives/2009/03/23/multi-row-carousel-and-image-loader-with-jquery/</link>
		<comments>http://www.scriptygoddess.com/archives/2009/03/23/multi-row-carousel-and-image-loader-with-jquery/#comments</comments>
		<pubDate>Mon, 23 Mar 2009 18:04:09 +0000</pubDate>
		<dc:creator>Jennifer</dc:creator>
				<category><![CDATA[Javascript]]></category>
		<category><![CDATA[jquery]]></category>
		<category><![CDATA[Scripts]]></category>

		<guid isPermaLink="false">http://www.scriptygoddess.com/?p=1608</guid>
		<description><![CDATA[A recent project I&#039;ve been working on involved a portfolio page that required a &#034;carousel&#034; type browser. It also needed to have multiple rows (so that images could be grouped into various projects). Also, because this page would contain a large number of images, it was required that the images not be loaded until you [...]
No related posts.

Related posts brought to you by <a href='http://yarpp.org'>Yet Another Related Posts Plugin</a>.]]></description>
			<content:encoded><![CDATA[<p>A recent project I&#039;ve been working on involved a portfolio page that required a &#034;carousel&#034; type browser. It also needed to have multiple rows (so that images could be grouped into various projects). Also, because this page would contain a large number of images, it was required that the images not be loaded until you pulled up that particular project/row in the carousel. </p>
<p>There are a lot of carousel scripts out there, and there is a <a href="http://flesler.blogspot.com/2008/02/jqueryserialscroll.html">scrolling plugin</a> that I had been counting on to help me create what I needed &#8211; but to be honest, either I couldn&#039;t get those scripts to work the way I wanted them to, or I couldn&#039;t get them to work AT ALL. I spent a few frustrating days fighting with the plugins, when I finally threw in the towel. I knew what I wanted to do, and figured I&#039;d be better off hand coding specifically what I needed instead of retrofitting a pre-made plugin or script. It turned out to be less time consuming, and in the end I got exactly what I wanted.</p>
<p>So while this script was for a specific purpose, I thought I would put it out here anyway on the chance that it might work for or help someone else. It&#039;s probably possible to &#034;package it up&#034; into a more modular plugin.</p>
<p>So first <a href="http://www.scriptygoddess.com/resources/1608/multi-row-carousel.htm">here is the very rough, proof of concept/demo.</a> (no design on that page &#8211; just wanted to show how the script works) <img src='http://www.scriptygoddess.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p><a href="http://www.scriptygoddess.com/resources/1608/multi-row-carousel.zip">Here you can download all the files</a> (except the photos &#8211; I originally grabbed them from <a href="http://www.sxc.hu/">stock.xchng</a>)</p>
<p>I&#039;ll walk through just a few of the details of how the HTML needs to be structured in order to get the script to work &#8211; but the files in the zip are well commented and should explain the rest.</p>
<p>One important trick with this script is that there are some &#034;naming conventions&#034; that it relies on. Each row of photos is setup as a unordered list. The ID of that unordered list is used as a base for naming other related elements. So for example &#8211; the first row is named with and ID of &#034;row1&#034; &#8211; I use that base for the ID of a div that contains links to the images in that row. I want this div to only appear when that row1 is being shown. So the ID of the div needs to be created like <strong>ROW BASE NAME + &#034;-nav&#034;</strong>. So, specifically: &#034;<strong>row1-nav</strong>&#034;.</p>
<p>You&#039;ll notice in the HTML when I link to rows or specific images in the row &#8211; I didn&#039;t put the id of the image inside the &#034;href&#034; element. I actually repurposed the &#034;rel&#034; attribute and put the image I wanted to display in the carousel in that. (The script didn&#039;t work quite right if I put the row name in the href value). </p>
<p>Another &#034;repurpose&#034; I&#039;ve done is for use with the delayed image loading. In each of the LI element, I &#034;store&#034; the path to the image that will be loaded inside the LI element in the &#034;title&#034; tag.</p>
<p>I&#039;ve pulled out as many &#034;variables&#034; as I could in the javascript.js &#8211; row names, image names, classnames &#8211; and explained what they are and how they relate to the HTML in the comments to make reusing the code as easy as possible.</p>
<p>So an important note, I don&#039;t claim this to be an easy to use plugin. If you&#039;re going to use this script, you do have to some level of understanding of jquery, javascript, html. I also can&#039;t promise too much (un-paid) support. If you want to use it, you&#039;re welcome to it &#8211; please leave the credit lines in place &#8211; I spent quite a bit of time getting this to work. And for my own curiosity, I&#039;d love it if you came back here and posted a link to where you&#039;re using it. If you can&#039;t get it to work, you&#039;re welcome to post a question here, but I can&#039;t guarantee I&#039;ll be able to help out.</p>
<p>No related posts.</p>
<p>Related posts brought to you by <a href='http://yarpp.org'>Yet Another Related Posts Plugin</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://www.scriptygoddess.com/archives/2009/03/23/multi-row-carousel-and-image-loader-with-jquery/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>jQuery Side Scroll</title>
		<link>http://www.scriptygoddess.com/archives/2009/02/01/jquery-side-scroll/</link>
		<comments>http://www.scriptygoddess.com/archives/2009/02/01/jquery-side-scroll/#comments</comments>
		<pubDate>Sun, 01 Feb 2009 07:02:56 +0000</pubDate>
		<dc:creator>Jennifer</dc:creator>
				<category><![CDATA[jquery]]></category>

		<guid isPermaLink="false">http://www.scriptygoddess.com/?p=1577</guid>
		<description><![CDATA[(This post has been almost completely re-written. Usually I don&#039;t that &#8211; but I thought it would be more confusing to have all the changes, strikeouts, etc.) For a project I&#039;m going to be working on, I needed to create a navigation piece that had different panes scrolling/sliding in from the right depending on what [...]
No related posts.

Related posts brought to you by <a href='http://yarpp.org'>Yet Another Related Posts Plugin</a>.]]></description>
			<content:encoded><![CDATA[<p>(This post has been almost completely re-written. Usually I don&#039;t that &#8211; but I thought it would be more confusing to have all the changes, strikeouts, etc.)</p>
<p>For a project I&#039;m going to be working on, I needed to create a navigation piece that had different panes scrolling/sliding in from the right depending on what item you clicked. I&#039;ve seen lots of options for vertical accordions. Not as many, but a few, options for horizontal accordions. My situation was unique in that the click was not near or part of the scrolling panes. And it should disappear completely out of view if not the current pane so that if clicked again, it would again animate in. But if already in view &#8211; I wanted it to stay until the new pane coming in covered it completely.</p>
<p>Went through a few versions of this, and finally I have something I&#039;m satisfied with. <a href="http://www.scriptygoddess.com/resources/jquery-side-scroll/blockslider-absoluteposition-ver3.html">Here&#039;s the demo.</a></p>
<p>View source on that page to see the full html and jquery code. Now I&#039;ll walk you through what my logic was&#8230;</p>
<p><code>var lastpane;<br />
var href;<br />
var zcount = 2;<br />
var inprogress = false;</code></p>
<p>That&#039;s just calling out some variables we&#039;ll be using in various iterations. &#034;href&#034; will be used to hold a reference to the current element/pane. &#034;zcount&#034; will make sure the current pane always has the highest z-index. &#034;inprogress&#034; will keep track of whether there is currently a pane being animated or not and will hold the other clicks/animations until the current pane animation is complete</p>
<p><code>$('a').click(function(){</code></p>
<p>Obviously, if this gets used in something other than a proof of concept, you&#039;ll probably have to be more specific about WHICH &#039;a&#039; &#8211; ie &#8211; give the links you want to use for this a style like class=&#034;paneslider&#034; and then change that to $(&#039;a.paneslider&#039;)&#8230; etc. In any case, the above just says, run the following whenever a link is clicked.</p>
<p><code>if (!inprogress &#038;&#038; $(this).attr('title') != lastpane) {</code></p>
<p>Here I&#039;m checking to make sure that an animation isn&#039;t already in progress, and the currently clicked link does not match the pane currently in view. (Which would have been defined as &#034;lastpane&#034;</p>
<p><code>inprogress = true;<br />
zcount = zcount+1;</code></p>
<p>Set in progress to true right away so that we don&#039;t have conflicting animations. And add 1 to zcount (z-index), which will make the current pane appear above any other that is visible.</p>
<p><code>$(lastpane).css("z-index","1");</code></p>
<p>Give the last element pane shown (defined as &#034;lastpane&#034;) a z-index of 1 to make sure it appears below the pane we want to have move across the screen.</p>
<p><code>var href = $(this).attr('href');</code></p>
<p>Now we&#039;ll redefine href as the current pane we want to animate. (This, by the way is set in the html &#8211; in the &#034;a&#034; tag using the &#034;title&#034; attribute).</p>
<p><code>$(href).css("left","800px");<br />
$(href).css("z-index",zcount);</code></p>
<p>Make sure that the current pane is starting out completely out of view, and then giving it the highest z-index.</p>
<p><code>$(href).animate({"left": "0"}, 2000, function() {</code></p>
<p>Now we start our animation. Move it across to absolute position of 0 in 2000 milliseconds. As well we use a callback function to do the following after the pane finished moving.</p>
<p><code>$(lastpane).css("left","800px");<br />
lastpane = href;<br />
inprogress = false;</code></p>
<p>We move the pane that is now hidden under the current pane back to the &#034;starting&#034; position &#8211; and then we redefine &#034;lastpane&#034; with the pane that is now currently visible. And now that everything else is done, &#034;inprogress&#034; gets set back to false so we&#039;re open to run another pane across.</p>
<p>Then the rest of the code is all closing brackets etc.</p>
<p>Just for fun, I have another version of the sliding pane thing using the &#034;<a href="http://gsgd.co.uk/sandbox/jquery/easing/">easing plugin</a>&#034;. <a href="http://www.scriptygoddess.com/resources/jquery-side-scroll/blockslider-absoluteposition-ver3-withbounce.html">Here&#039;s the demo using a bounce as it comes in</a>.</p>
<p>No related posts.</p>
<p>Related posts brought to you by <a href='http://yarpp.org'>Yet Another Related Posts Plugin</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://www.scriptygoddess.com/archives/2009/02/01/jquery-side-scroll/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>Overlapping Tabbed Navigation using CSS and jQuery</title>
		<link>http://www.scriptygoddess.com/archives/2008/09/20/overlapping-tabbed-navigation-using-css-and-jquery/</link>
		<comments>http://www.scriptygoddess.com/archives/2008/09/20/overlapping-tabbed-navigation-using-css-and-jquery/#comments</comments>
		<pubDate>Sat, 20 Sep 2008 20:51:13 +0000</pubDate>
		<dc:creator>Jennifer</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[jquery]]></category>

		<guid isPermaLink="false">http://www.scriptygoddess.com/?p=1528</guid>
		<description><![CDATA[Recently had a project land on my desk that required tabbed navigation that overlap one another. Just so we&#039;re clear on what we&#039;re doing: here&#039;s the demo. Here is how I did it: 1) Each tab has four &#034;states&#034; &#8211; Off, Off (with right tab on), On, On (with right tab on). I combined each [...]
No related posts.

Related posts brought to you by <a href='http://yarpp.org'>Yet Another Related Posts Plugin</a>.]]></description>
			<content:encoded><![CDATA[<p>Recently had a project land on my desk that required tabbed navigation that overlap one another. Just so we&#039;re clear on what we&#039;re doing: <a href="/resources/1528/overlappingtabs.html">here&#039;s the demo</a>. Here is how I did it:</p>
<p>1) Each tab has four &#034;states&#034; &#8211; Off, Off (with right tab on), On, On (with right tab on). I combined each of these four states in the one image for each tab. So it looks like this:</p>
<p><img src="/resources/1528/css/images/nav_about.gif" /></p>
<p>2) The HTML is pretty simple and looks like this:</p>
<p><code>&lt;div id="navbar"&gt;<br />
&lt;ul&gt;<br />
&lt;li id="nav_home"&gt;&lt;a href="#"&gt;&lt;span&gt;Home&lt;/span&gt;&lt;/a&gt;&lt;/li&gt;<br />
&lt;li id="nav_about"&gt;&lt;a href="#"&gt;&lt;span&gt;About Us&lt;/span&gt;&lt;/a&gt;&lt;/li&gt;<br />
&lt;li id="nav_products" class="right"&gt;&lt;a href="#"&gt;&lt;span&gt;Products&lt;/span&gt;&lt;/a&gt;&lt;/li&gt;<br />
&lt;li id="nav_sales" class="current"&gt;&lt;a href="#"&gt;&lt;span&gt;Sales Reps&lt;/span&gt;&lt;/a&gt;&lt;/li&gt;<br />
&lt;li id="nav_contact"&gt;&lt;a href="#"&gt;&lt;span&gt;Contact Us&lt;/span&gt;&lt;/a&gt;&lt;/li&gt;<br />
&lt;/ul&gt;<br />
&lt;/div&gt;</code></p>
<p>Notice that when one of the tabs is set as the &#034;current&#034; tab &#8211; we also need to define the tab before it with a class of &#034;right&#034; (meaning that the tab to the right of this one is set as &#034;on&#034;)</p>
<p>3) Then we define the various states in CSS. In this case, all the tabs are the same width and height:</p>
<p><code>#navbar li {<br />
float: left;<br />
}<br />
#navbar li a {<br />
display: block;<br />
height: 29px;<br />
width: 91px;<br />
}</code></p>
<p>Hide the text with css since we&#039;re using images for the tabs:</p>
<p><code>#navbar li a span {<br />
margin: 0 0 0 -100000px;<br />
}</code></p>
<p>Define the image to be used for each tab:</p>
<p><code>#nav_home a {<br />
background:url(images/nav_home.gif) top left no-repeat;<br />
}<br />
#nav_about a {<br />
background:url(images/nav_about.gif) top left no-repeat;<br />
}<br />
#nav_products a {<br />
background:url(images/nav_products.gif) top left no-repeat;<br />
}<br />
#nav_sales a {<br />
background:url(images/nav_sales.gif) top left no-repeat;<br />
}<br />
#nav_contact a {<br />
background:url(images/nav_contact.gif) top left no-repeat;<br />
}</code></p>
<p>4) I&#039;m going to skip over the rest of the class definitions and move to the jquery part &#8211; because I think it will make more sense to see how the classes are being defined if you see what class I&#039;m applying when and where.</p>
<p><code>&lt;script type="text/javascript" src="js/jquery-1.2.6.min.js"&gt;&lt;/script&gt;<br />
&lt;script type="text/javascript"&gt;<br />
var j = jQuery.noConflict();<br />
j(document).ready( function() {<br />
	j('#nav_about a').hover(function() {<br />
		j('#nav_home a').addClass("left");<br />
	}, function() {<br />
		j('#nav_home a').removeClass("left");<br />
	});<br />
	j('#nav_products a').hover(function() {<br />
		j('#nav_about a').addClass("left");<br />
	}, function() {<br />
		j('#nav_about a').removeClass("left");<br />
	});<br />
	j('#nav_sales a').hover(function() {<br />
		j('#nav_products a').addClass("left");<br />
	}, function() {<br />
		j('#nav_products a').removeClass("left");<br />
	});<br />
	j('#nav_contact a').hover(function() {<br />
		j('#nav_sales a').addClass("left");<br />
	}, function() {<br />
		j('#nav_sales a').removeClass("left");<br />
	});<br />
});<br />
&lt;/script&gt;</code></p>
<p>So what I&#039;m doing here is, anytime I mouseover a tab, I&#039;m adding the class &#034;left&#034; to the &lt;a&gt; tag in the tab <em>in front of</em> the one my mouse is on.</p>
<p>So if the tab <em>in front of</em> the one my mouse is on is &#034;off&#034; &#8211; then we need to change that tab to state #2 (Off &#8211; with the tab next to it on). If that tab has the class &#034;current&#034; applied to the li tag &#8211; then we need to move that tab to state #4 &#8211; (On &#8211; with the tab next to it on).</p>
<p>4) So on to the various states with css&#8230;.</p>
<p>When hovering &#8211; we go to the &#034;on&#034; state &#8211; (in this case, when tab is current, it lookes the same as when we mouse over it.) So the most basic state &#8211; state #3: Whether the tab is current, or hovering &#8211; move to that &#034;Third&#034; state: On &#8211; with the tab next door off.<br />
<code>#navbar li.current a,<br />
#navbar a:hover {<br />
background-position: 0 -58px;<br />
}</code></p>
<p>This is for state #2: Off &#8211; with the tab next to us as On. (the &#034;.right&#034; class applied to the li tag means that the tab in front is &#034;current&#034;)<br />
<code>#navbar li.right a,<br />
#navbar li a.left {<br />
background-position: 0 -29px;<br />
}</code></p>
<p>This is for state #4 &#8211; On with the tab next to us as on.<br />
<code>#navbar li.right a:hover,<br />
#navbar li.current a.left {<br />
background-position: 0 -87px;<br />
}</code></p>
<p>One thing to note &#8211; the last tab really only has two states &#8211; because there is no tab in front of it &#8211; but to keep things simple in the code and css &#8211; I just made the image with the extra versions. This way it could have the same styles applied to it &#8211; without having to make a special case for it.</p>
<p>Here are some more demos:</p>
<p><a href="/resources/1528/overlappingtabs1.html">No tab set as current</a></p>
<p><a href="/resources/1528/overlappingtabs2.html">Home tab set as current</a> (no &#034;right&#034; class needs to be applied &#8211; since home is the first tab)</p>
<p><a href="/resources/1528/overlappingtabs3.html">Last tab set as current</a></p>
<p>No related posts.</p>
<p>Related posts brought to you by <a href='http://yarpp.org'>Yet Another Related Posts Plugin</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://www.scriptygoddess.com/archives/2008/09/20/overlapping-tabbed-navigation-using-css-and-jquery/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>jQuery Method for Validation Plugin &#8211; &quot;field must include at least one number&quot;</title>
		<link>http://www.scriptygoddess.com/archives/2008/09/07/jquery-method-for-validation-plugi-field-must-include-at-least-one-number/</link>
		<comments>http://www.scriptygoddess.com/archives/2008/09/07/jquery-method-for-validation-plugi-field-must-include-at-least-one-number/#comments</comments>
		<pubDate>Sun, 07 Sep 2008 21:37:45 +0000</pubDate>
		<dc:creator>Jennifer</dc:creator>
				<category><![CDATA[jquery]]></category>

		<guid isPermaLink="false">http://www.scriptygoddess.com/?p=1524</guid>
		<description><![CDATA[Here&#039;s a method you can use with the validation jQuery plugin to make sure a field (like a password field) includes at least one number. $.validator.addMethod("atleastonedigit", function(pass) { if (pass == "") { return true; } return ((/[0-9]+/).test(pass)); }, "This field must contain at least one number"); No related posts. Related posts brought to you [...]
No related posts.

Related posts brought to you by <a href='http://yarpp.org'>Yet Another Related Posts Plugin</a>.]]></description>
			<content:encoded><![CDATA[<p>Here&#039;s a method you can use with the <a href="http://bassistance.de/jquery-plugins/jquery-plugin-validation/">validation jQuery plugin</a> to make sure a field (like a password field) includes at least one number.</p>
<p><code>$.validator.addMethod("atleastonedigit", function(pass) {<br />
if (pass == "") {<br />
return true;<br />
}<br />
return ((/[0-9]+/).test(pass));<br />
}, "This field must contain at least one number");</code></p>
<p>No related posts.</p>
<p>Related posts brought to you by <a href='http://yarpp.org'>Yet Another Related Posts Plugin</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://www.scriptygoddess.com/archives/2008/09/07/jquery-method-for-validation-plugi-field-must-include-at-least-one-number/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Proportional Scaling Calculator</title>
		<link>http://www.scriptygoddess.com/archives/2008/05/13/proportional-scaling-calculator/</link>
		<comments>http://www.scriptygoddess.com/archives/2008/05/13/proportional-scaling-calculator/#comments</comments>
		<pubDate>Tue, 13 May 2008 15:44:21 +0000</pubDate>
		<dc:creator>Jennifer</dc:creator>
				<category><![CDATA[Javascript]]></category>
		<category><![CDATA[Scripts]]></category>

		<guid isPermaLink="false">http://www.scriptygoddess.com/?p=1518</guid>
		<description><![CDATA[I&#039;m sure this has been done before since it&#039;s pretty simple &#8211; I just couldn&#039;t find it quick enough when I needed it. And since it is so simple, it was easier to just create my own personal little calculator than dig around, find one, bookmark. (or worse yet, do the math on a little [...]
No related posts.

Related posts brought to you by <a href='http://yarpp.org'>Yet Another Related Posts Plugin</a>.]]></description>
			<content:encoded><![CDATA[<p>I&#039;m sure this has been done before since it&#039;s pretty simple &#8211; I just couldn&#039;t find it quick enough when I needed it. And since it is so simple, it was easier to just create my own personal little calculator than dig around, find one, bookmark. (or worse yet, do the math on a little sticky note next to my computer) ;P</p>
<p>This calculator will let you enter in the original width and height of an image (or document, video or whatever). Then you enter the width (or height) of the size you need it scaled to (down or up). And it will tell you what the other side needs to be.</p>
<p>For example: I have an 800&#215;600 image &#8211; I need it scaled down to fit in a 256 width area&#8230; what height will I need to make it? This tool will answer your question.</p>
<p><a href="http://scriptygoddess.com/resources/proportioncalc.htm">Proportional Scaler Calculator</a></p>
<p>No related posts.</p>
<p>Related posts brought to you by <a href='http://yarpp.org'>Yet Another Related Posts Plugin</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://www.scriptygoddess.com/archives/2008/05/13/proportional-scaling-calculator/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>

