<?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>JQuery, PHP, html, design... // arnaud-k : un blog de geek &#187; styleswitcher</title>
	<atom:link href="http://blog.arnaud-k.fr/tag/styleswitcher/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.arnaud-k.fr</link>
	<description>Le blog JQuery, Html, Web Design</description>
	<lastBuildDate>Thu, 21 Apr 2011 08:10:17 +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>Changer le style de la page à la volée avec le plugin JQuery Style Switcher</title>
		<link>http://blog.arnaud-k.fr/2009/09/09/changer-le-style-de-la-page-a-la-volee-avec-le-plugin-jquery-style-switcher/</link>
		<comments>http://blog.arnaud-k.fr/2009/09/09/changer-le-style-de-la-page-a-la-volee-avec-le-plugin-jquery-style-switcher/#comments</comments>
		<pubDate>Wed, 09 Sep 2009 07:57:15 +0000</pubDate>
		<dc:creator>arnaud</dc:creator>
				<category><![CDATA[JQuery]]></category>
		<category><![CDATA[plugin JQuery]]></category>
		<category><![CDATA[styleswitcher]]></category>

		<guid isPermaLink="false">http://blog.arnaud-k.fr/?p=1286</guid>
		<description><![CDATA[Le plugin JQuery Style Switcher (par Kevinluck) permet, comme son nom l&#8217;indique, de changer le style de la page. Le plugin donne donc la possibilité de changer la feuille de style attachée à la page sans aucun rechargement de la&#160;[...]</p> <p class="read-more"><a class="gray normal" href="http://blog.arnaud-k.fr/2009/09/09/changer-le-style-de-la-page-a-la-volee-avec-le-plugin-jquery-style-switcher/">Lire la suite&#160;&#62;&#62;</a></p>]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fblog.arnaud-k.fr%2F2009%2F09%2F09%2Fchanger-le-style-de-la-page-a-la-volee-avec-le-plugin-jquery-style-switcher%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fblog.arnaud-k.fr%2F2009%2F09%2F09%2Fchanger-le-style-de-la-page-a-la-volee-avec-le-plugin-jquery-style-switcher%2F&amp;source=arnaudk&amp;style=compact&amp;service=bit.ly&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
<p><img class="aligncenter size-full wp-image-1287" title="styleswitcher" src="http://blog.arnaud-k.fr/wp-content/uploads/2009/09/styleswitcher.png" alt="styleswitcher" width="600" height="200" /></p>
<p><strong>Le plugin JQuery <a href="http://www.kelvinluck.com/2006/05/switch-stylesheets-with-jquery/">Style Switcher</a> (par Kevinluck)</strong> permet, comme son nom l&#8217;indique, de changer le style de la page. Le plugin donne donc la possibilité de <strong>changer la feuille de style attachée à la page sans aucun rechargement de la page</strong>.</p>
<p>Il est donc facile de mettre en place des liens pour <strong>permettre à l&#8217;utilisateur de sélectionner le style qu&#8217;il veut</strong>. Le plugin se permet même de créer un cookie pour enregistrer le style préféré du visiteur pour l&#8217;afficher par défaut lors de la prochaine visite !</p>
<p><a href="http://blog.arnaud-k.fr/demos/styleSwitcher/" class="demo" title="voir la demo de JQuery Style Switcher">voir la demo de JQuery Style Switcher</a></p>
<p><strong>La mise en place du plugin JQuery est très simple</strong>. Pour cela il suffit comme à chaque d&#8217;importer le framework JQuery et le plugin dans la page, d&#8217;ajouter la classe &laquo;&nbsp;styleswitch&nbsp;&raquo; aux liens sur lesquels on souhaite appliquer le styleswitch. Il faut également penser à mettre en attribut &laquo;&nbsp;rel&nbsp;&raquo; du lien le nom du style que l&#8217;on va activer :</p>

<div class="wp_syntax"><div class="code"><pre class="html4strict" style="font-family:monospace;"><span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">a</span> <span style="color: #000066;">href</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;#&quot;</span> <span style="color: #000066;">rel</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;style&quot;</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;styleswitch&quot;</span>&gt;</span>style 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;">a</span> <span style="color: #000066;">href</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;#&quot;</span> <span style="color: #000066;">rel</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;style2&quot;</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;styleswitch&quot;</span>&gt;</span>style 2<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">a</span>&gt;</span></pre></div></div>

<p>Enfin, entre les balises &lt;head&gt;,<strong> il faut importer toutes les feuilles de style que l&#8217;on veut</strong> en ajoutant &laquo;&nbsp;alternate&nbsp;&raquo; dans l&#8217;attribut &laquo;&nbsp;rel&nbsp;&raquo; de la balise &lt;link&gt; des feuilles de style qui ne seront pas activées par défaut et mettre dans l&#8217;attribut title le nom du style (pour qu&#8217;il soit bien lié au lien que l&#8217;on souhaite) :</p>

<div class="wp_syntax"><div class="code"><pre class="html4strict" style="font-family:monospace;"><span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">link</span> <span style="color: #000066;">rel</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;stylesheet&quot;</span>  <span style="color: #000066;">href</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;feuilledestyle1.css&quot;</span> <span style="color: #000066;">type</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;text/css&quot;</span> <span style="color: #000066;">title</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;style&quot;</span> <span style="color: #66cc66;">/</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">link</span> <span style="color: #000066;">rel</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;alternate stylesheet&quot;</span> <span style="color: #000066;">type</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;feuilledestyle2.css&quot;</span> <span style="color: #000066;">title</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;style2&quot;</span> <span style="color: #66cc66;">/</span>&gt;</span></pre></div></div>

<p><strong>Il n&#8217;y a rien de plus à faire, le plugin s&#8217;occupe de tout !</strong></p>


<p>Pas encore de billet sur le même sujet !</p>]]></content:encoded>
			<wfw:commentRss>http://blog.arnaud-k.fr/2009/09/09/changer-le-style-de-la-page-a-la-volee-avec-le-plugin-jquery-style-switcher/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

