<?xml version="1.0" encoding="UTF-8"?><!-- generator="wordpress/2.1" -->
<rss version="2.0" 
	xmlns:content="http://purl.org/rss/1.0/modules/content/">
<channel>
	<title>Comments on: Style Sheet Switcheroo</title>
	<link>http://15daysofjquery.com/style-sheet-switcheroo/12/</link>
	<description>Examples and tutorials to help you learn JQuery</description>
	<pubDate>Sat, 05 Jul 2008 19:02:37 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.1</generator>

	<item>
		<title>By: Sam</title>
		<link>http://15daysofjquery.com/style-sheet-switcheroo/12/#comment-90</link>
		<author>Sam</author>
		<pubDate>Sun, 18 Jun 2006 22:51:24 +0000</pubDate>
		<guid>http://15daysofjquery.com/style-sheet-switcheroo/12/#comment-90</guid>
					<description>Thanks for taking time to post these examples.  Here's my 2-cents on further code reduction:

Replace
 this.disabled = true;
                if (this.getAttribute('title') == styleName) this.disabled = false;

With

this.disabled = this.getAttribute('title') != styleName;</description>
		<content:encoded><![CDATA[<p>Thanks for taking time to post these examples.  Here&#8217;s my 2-cents on further code reduction:</p>
<p>Replace<br />
 this.disabled = true;<br />
                if (this.getAttribute(&#8217;title&#8217;) == styleName) this.disabled = false;</p>
<p>With</p>
<p>this.disabled = this.getAttribute(&#8217;title&#8217;) != styleName;</p>
]]></content:encoded>
				</item>
	<item>
		<title>By: v</title>
		<link>http://15daysofjquery.com/style-sheet-switcheroo/12/#comment-94</link>
		<author>v</author>
		<pubDate>Mon, 19 Jun 2006 23:53:44 +0000</pubDate>
		<guid>http://15daysofjquery.com/style-sheet-switcheroo/12/#comment-94</guid>
					<description>Doesn't work in Safari.</description>
		<content:encoded><![CDATA[<p>Doesn&#8217;t work in Safari.</p>
]]></content:encoded>
				</item>
	<item>
		<title>By: joon</title>
		<link>http://15daysofjquery.com/style-sheet-switcheroo/12/#comment-455</link>
		<author>joon</author>
		<pubDate>Mon, 23 Oct 2006 15:30:15 +0000</pubDate>
		<guid>http://15daysofjquery.com/style-sheet-switcheroo/12/#comment-455</guid>
					<description>Is $(document).ready(function().. absolutely necessary in this case? In Safari the default style sheet is rendered for a split second then the chosen style is loaded on each page load.

If it's possible, let the browser execute as it's being read. Me (big noob) has to test it out.

Thanks for the tutorials.!</description>
		<content:encoded><![CDATA[<p>Is $(document).ready(function().. absolutely necessary in this case? In Safari the default style sheet is rendered for a split second then the chosen style is loaded on each page load.</p>
<p>If it&#8217;s possible, let the browser execute as it&#8217;s being read. Me (big noob) has to test it out.</p>
<p>Thanks for the tutorials.!</p>
]]></content:encoded>
				</item>
	<item>
		<title>By: nic</title>
		<link>http://15daysofjquery.com/style-sheet-switcheroo/12/#comment-4190</link>
		<author>nic</author>
		<pubDate>Tue, 03 Apr 2007 23:50:42 +0000</pubDate>
		<guid>http://15daysofjquery.com/style-sheet-switcheroo/12/#comment-4190</guid>
					<description>How would you modify this code to load a specific style sheet based on an attribute in the ? I've been mucking around in the code and I've gotten totally confused.

Thanks for all the tutorials, you've gotten me hooked on jquery.</description>
		<content:encoded><![CDATA[<p>How would you modify this code to load a specific style sheet based on an attribute in the ? I&#8217;ve been mucking around in the code and I&#8217;ve gotten totally confused.</p>
<p>Thanks for all the tutorials, you&#8217;ve gotten me hooked on jquery.</p>
]]></content:encoded>
				</item>
	<item>
		<title>By: nic</title>
		<link>http://15daysofjquery.com/style-sheet-switcheroo/12/#comment-4191</link>
		<author>nic</author>
		<pubDate>Tue, 03 Apr 2007 23:51:26 +0000</pubDate>
		<guid>http://15daysofjquery.com/style-sheet-switcheroo/12/#comment-4191</guid>
					<description>it's supposed to say... based on an attribute in the body tag.</description>
		<content:encoded><![CDATA[<p>it&#8217;s supposed to say&#8230; based on an attribute in the body tag.</p>
]]></content:encoded>
				</item>
	<item>
		<title>By: Jack</title>
		<link>http://15daysofjquery.com/style-sheet-switcheroo/12/#comment-4215</link>
		<author>Jack</author>
		<pubDate>Wed, 04 Apr 2007 15:49:22 +0000</pubDate>
		<guid>http://15daysofjquery.com/style-sheet-switcheroo/12/#comment-4215</guid>
					<description>Should be easy enough, just grab the class or attribute of the body tag, and pop that into the mix.

This is an untested quickie based on an id:

$('body').each(function(){
  switchStylestyle(this.id);
  });

But I also think that you can perform the same or similar without the use of javascript by putting a class name and/or id in the body tag of your document, and then putting the appropriate rules in your css

body#one p { color: black; }
body#two p { color: red;}</description>
		<content:encoded><![CDATA[<p>Should be easy enough, just grab the class or attribute of the body tag, and pop that into the mix.</p>
<p>This is an untested quickie based on an id:</p>
<p>$(&#8217;body&#8217;).each(function(){<br />
  switchStylestyle(this.id);<br />
  });</p>
<p>But I also think that you can perform the same or similar without the use of javascript by putting a class name and/or id in the body tag of your document, and then putting the appropriate rules in your css</p>
<p>body#one p { color: black; }<br />
body#two p { color: red;}</p>
]]></content:encoded>
				</item>
	<item>
		<title>By: nic</title>
		<link>http://15daysofjquery.com/style-sheet-switcheroo/12/#comment-4231</link>
		<author>nic</author>
		<pubDate>Wed, 04 Apr 2007 23:32:47 +0000</pubDate>
		<guid>http://15daysofjquery.com/style-sheet-switcheroo/12/#comment-4231</guid>
					<description>Jack,

Thanks for the example, that's exactly what I needed.

I've been doing the tutorials on jQuery and I literally know 200% more than when I wrote that first question. The problem I'm trying to solve is that we want to have an individual style for multiple users on the same set of pages.

For example two people visit page Cranberry, if user A came from page Apple they would have the Apple style loaded, and if user B came from page Banana they would have the Banana style loaded. 

If someone visited Cranberry straight up they would see the default theme.

We already had this system in place using an onLoad script, but I wanted to switch over to jQuery.</description>
		<content:encoded><![CDATA[<p>Jack,</p>
<p>Thanks for the example, that&#8217;s exactly what I needed.</p>
<p>I&#8217;ve been doing the tutorials on jQuery and I literally know 200% more than when I wrote that first question. The problem I&#8217;m trying to solve is that we want to have an individual style for multiple users on the same set of pages.</p>
<p>For example two people visit page Cranberry, if user A came from page Apple they would have the Apple style loaded, and if user B came from page Banana they would have the Banana style loaded. </p>
<p>If someone visited Cranberry straight up they would see the default theme.</p>
<p>We already had this system in place using an onLoad script, but I wanted to switch over to jQuery.</p>
]]></content:encoded>
				</item>
	<item>
		<title>By: Mike</title>
		<link>http://15daysofjquery.com/style-sheet-switcheroo/12/#comment-5371</link>
		<author>Mike</author>
		<pubDate>Thu, 26 Apr 2007 16:42:12 +0000</pubDate>
		<guid>http://15daysofjquery.com/style-sheet-switcheroo/12/#comment-5371</guid>
					<description>Oops, forgot to mention one thing. In the line that generates the random number:

var randNum = Math.floor(Math.random() * 4);

Change the number you are multiplying by, in this case 4, to the number of alternate stylesheets you have listed, or one more than the last 'title' number. In my case I have 4 alternate stylesheets numbered 0 through 3, so I multiply by 4.</description>
		<content:encoded><![CDATA[<p>Oops, forgot to mention one thing. In the line that generates the random number:</p>
<p>var randNum = Math.floor(Math.random() * 4);</p>
<p>Change the number you are multiplying by, in this case 4, to the number of alternate stylesheets you have listed, or one more than the last &#8216;title&#8217; number. In my case I have 4 alternate stylesheets numbered 0 through 3, so I multiply by 4.</p>
]]></content:encoded>
				</item>
	<item>
		<title>By: Aleksey</title>
		<link>http://15daysofjquery.com/style-sheet-switcheroo/12/#comment-37953</link>
		<author>Aleksey</author>
		<pubDate>Fri, 30 May 2008 12:59:06 +0000</pubDate>
		<guid>http://15daysofjquery.com/style-sheet-switcheroo/12/#comment-37953</guid>
					<description>It's all based on an attribute in the body tag...</description>
		<content:encoded><![CDATA[<p>It&#8217;s all based on an attribute in the body tag&#8230;</p>
]]></content:encoded>
				</item>
</channel>
</rss>
