<?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; html</title>
	<atom:link href="http://blog.arnaud-k.fr/tag/html/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>Aides-mémoires pour la création de site web (couleurs, css, php, JQuery&#8230;)</title>
		<link>http://blog.arnaud-k.fr/2009/04/27/aides-memoires-pour-la-creation-de-site-web-couleurs-css-php-jquery/</link>
		<comments>http://blog.arnaud-k.fr/2009/04/27/aides-memoires-pour-la-creation-de-site-web-couleurs-css-php-jquery/#comments</comments>
		<pubDate>Mon, 27 Apr 2009 10:20:28 +0000</pubDate>
		<dc:creator>arnaud</dc:creator>
				<category><![CDATA[news du web]]></category>
		<category><![CDATA[aide-mémoire]]></category>
		<category><![CDATA[couleurs]]></category>
		<category><![CDATA[html]]></category>
		<category><![CDATA[JQuery]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://blog.arnaud-k.fr/?p=377</guid>
		<description><![CDATA[Pour commencer la semaine, une belle liste de mementos pour tout ce qui concerne la création de site internet : Les couleurs web Aide-mémoire html Mémento CSS Aide-mémoire PHP Aide-mémoire en JQuery (que j&#8217;ai personnellement imprimé et scotché à mon&#160;[...]</p> <p class="read-more"><a class="gray normal" href="http://blog.arnaud-k.fr/2009/04/27/aides-memoires-pour-la-creation-de-site-web-couleurs-css-php-jquery/">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%2F04%2F27%2Faides-memoires-pour-la-creation-de-site-web-couleurs-css-php-jquery%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fblog.arnaud-k.fr%2F2009%2F04%2F27%2Faides-memoires-pour-la-creation-de-site-web-couleurs-css-php-jquery%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-378" title="jquery aide memoire" src="http://blog.arnaud-k.fr/wp-content/uploads/2009/04/jquery-aide-memoire.png" alt="jquery aide memoire" width="600" height="200" />Pour commencer la semaine, une belle liste de mementos pour tout ce qui concerne la création de site internet :</p>
<ul>
<li><a href="http://www.visibone.com/color/hexagon_800.gif">Les couleurs web<br />
</a><a href="http://www.visibone.com/color/hexagon_800.gif"><img class="alignnone size-full wp-image-379" style="margin-bottom:20px;" title="memento couleurs web" src="http://blog.arnaud-k.fr/wp-content/uploads/2009/04/aide-couleurs.png" alt="memento couleurs web" width="150" height="150" /></a></li>
<li><a href="http://training.snd.org/2009/web-design/syllabus/HTML-sheet.pdf">Aide-mémoire html</a><br />
<a href="http://training.snd.org/2009/web-design/syllabus/HTML-sheet.pdf"><img class="alignnone size-full wp-image-381" style="margin-bottom:20px;" title="aide-html" src="http://blog.arnaud-k.fr/wp-content/uploads/2009/04/aide-html.png" alt="aide-html" width="150" height="150" /><br />
</a></li>
<li><a href="http://training.snd.org/2009/web-design/syllabus/HTML-sheet.pdf">Mémento CSS</a><br />
<a href="http://training.snd.org/2009/web-design/syllabus/HTML-sheet.pdf"><img class="alignnone size-full wp-image-383" style="margin-bottom:20px;" title="Mémento CSS" src="http://blog.arnaud-k.fr/wp-content/uploads/2009/04/aide-css1.png" alt="Mémento CSS" width="150" height="150" /><br />
</a></li>
<li><a href="http://www.emezeta.com/weblog/emezeta-php-card-v0.2.png">Aide-mémoire PHP</a><br />
<img class="alignnone size-full wp-image-384" style="margin-bottom:20px;" title="aide-mémoire en php" src="http://blog.arnaud-k.fr/wp-content/uploads/2009/04/aide-php.png" alt="aide-mémoire en php" width="150" height="150" /></li>
<li><a href="http://colorcharge.com/wp-content/uploads/2007/12/jquery12_colorcharge.png">Aide-mémoire en JQuery</a> (que j&#8217;ai personnellement imprimé et scotché à mon bureau <img src='http://blog.arnaud-k.fr/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' />  )<br />
<a href="http://colorcharge.com/wp-content/uploads/2007/12/jquery12_colorcharge.png"><img class="alignnone size-full wp-image-385" style="margin-bottom:20px;" title="aide-mémoire jquery" src="http://blog.arnaud-k.fr/wp-content/uploads/2009/04/aide-jquery.png" alt="aide-mémoire jquery" width="150" height="150" /></a></li>
</ul>
<p>Il y a là de quoi bien redécorer son bureau, il y en a de toutes les couleurs !</p>


<p>Pas encore de billet sur le même sujet !</p>]]></content:encoded>
			<wfw:commentRss>http://blog.arnaud-k.fr/2009/04/27/aides-memoires-pour-la-creation-de-site-web-couleurs-css-php-jquery/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Tutorial : connexion en AJAX avec JQuery et PHP</title>
		<link>http://blog.arnaud-k.fr/2009/04/22/tutorial-connexion-en-ajax-avec-jquery-et-php/</link>
		<comments>http://blog.arnaud-k.fr/2009/04/22/tutorial-connexion-en-ajax-avec-jquery-et-php/#comments</comments>
		<pubDate>Wed, 22 Apr 2009 12:12:54 +0000</pubDate>
		<dc:creator>arnaud</dc:creator>
				<category><![CDATA[JQuery]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[ajax]]></category>
		<category><![CDATA[formulaire de connexion]]></category>
		<category><![CDATA[html]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://blog.arnaud-k.fr/?p=310</guid>
		<description><![CDATA[Pour ce premier tutorial AJAX, je propose un simple formulaire de connexion sans rafraichissement de la page. Ca permettra également d&#8217;introduire un peu de php sur le blog. Il est possible d&#8217;essayer une démo (login : test, mot de passe&#160;[...]</p> <p class="read-more"><a class="gray normal" href="http://blog.arnaud-k.fr/2009/04/22/tutorial-connexion-en-ajax-avec-jquery-et-php/">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%2F04%2F22%2Ftutorial-connexion-en-ajax-avec-jquery-et-php%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fblog.arnaud-k.fr%2F2009%2F04%2F22%2Ftutorial-connexion-en-ajax-avec-jquery-et-php%2F&amp;source=arnaudk&amp;style=compact&amp;service=bit.ly&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
<p>
Pour ce premier tutorial AJAX, je propose un simple f<strong>ormulaire de connexion sans rafraichissement de la page</strong>. Ca permettra également d&#8217;introduire un peu de php sur le blog.
</p>
<p><img src="http://blog.arnaud-k.fr/wp-content/uploads/2009/04/connexion-ajax.png" alt="connexion en ajax avec JQuery et PHP" title="connexion en ajax avec JQuery et PHP" width="600" height="200" class="alignnone size-full wp-image-311" /></p>
<p>
<strong>Il est possible d&#8217;<a href="http://blog.arnaud-k.fr/connexionAjax/">essayer une démo</a> (login : test, mot de passe : ajax) ou de <a href="http://blog.arnaud-k.fr/connexionAjax/connexionAjax.zip">télécharger la source</a> de cette démo</strong> (fichier php et mise en forme css inclus). Tout le code affiché ici sera du code dépouillé de tout mise en forme.
</p>
<p>
Pour commencer, on va <strong>préparer le formulaire HTML</strong> servant à la connexion. Deux champs sont nécessaires : nom d&#8217;utilsateur et mot de passe. Il ne faut pas oublier de donner un id (ici &laquo;&nbsp;connexionForm&nbsp;&raquo;) au formulaire pour la gestion des évènements avec JQuery. J&#8217;ai également ajouté un <strong>span vide qui contiendra éventuellement un message d&#8217;erreur</strong> si le login ou le mot de passe n&#8217;est pas bon.
</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
</pre></td><td class="code"><pre class="html4strict" style="font-family:monospace;"><span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">form</span> <span style="color: #000066;">name</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;connexionForm&quot;</span> <span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;connexionForm&quot;</span> <span style="color: #000066;">action</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;#&quot;</span>&gt;</span><span style="color: #808080; font-style: italic;">&lt;!-- début du formulaire de connexion --&gt;</span>   
	<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">span</span> <span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;erreur&quot;</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">span</span>&gt;</span><span style="color: #808080; font-style: italic;">&lt;!-- span qui contiendra les éventuels messages d'erreur --&gt;</span>
&nbsp;
	<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">label</span> <span style="color: #000066;">for</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;login&quot;</span>&gt;</span>Nom d'utilisateur :<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">label</span>&gt;</span>
        <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">input</span> <span style="color: #000066;">type</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;text&quot;</span> <span style="color: #000066;">name</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;login&quot;</span> <span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;login&quot;</span> <span style="color: #66cc66;">/</span>&gt;</span><span style="color: #808080; font-style: italic;">&lt;!-- champ pour le login --&gt;</span>
&nbsp;
	<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">label</span> <span style="color: #000066;">for</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;pass&quot;</span>&gt;</span>Mot de passe :<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">label</span>&gt;</span>
	<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">input</span> <span style="color: #000066;">type</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;password&quot;</span> <span style="color: #000066;">name</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;pass&quot;</span> <span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;pass&quot;</span> <span style="color: #66cc66;">/</span>&gt;</span><span style="color: #808080; font-style: italic;">&lt;!-- champ pour le mot de passe --&gt;</span>
&nbsp;
        <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">input</span> <span style="color: #000066;">type</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;submit&quot;</span> <span style="color: #000066;">value</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;Je me connecte&quot;</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;bouton&quot;</span> <span style="color: #66cc66;">/</span>&gt;</span><span style="color: #808080; font-style: italic;">&lt;!-- bouton de connexion --&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">form</span>&gt;</span><span style="color: #808080; font-style: italic;">&lt;!-- fin du formulaire --&gt;</span></pre></td></tr></table></div>

<p>
On passe ensuite à la partie JQuery. On commence par charger le framework dans le fichier html (entre les balises &lt;head&gt; et &lt;/head&gt;).
</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</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;">type</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;text/javascript&quot;</span> <span style="color: #000066;">src</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js&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>

<p>
A nous de jouer maintenant. <strong>L&#8217;appel en Ajax ne se fera qu&#8217;à la soumission du formulaire</strong> (avec l&#8217;événement &laquo;&nbsp;submit()&nbsp;&raquo;, ligne 2).
</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
</pre></td><td class="code"><pre class="javascript" style="font-family:monospace;">$<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> 
	$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;#connexionForm&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">submit</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>	<span style="color: #006600; font-style: italic;">// à la soumission du formulaire						 </span>
		$.<span style="color: #660066;">ajax</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#123;</span> <span style="color: #006600; font-style: italic;">// fonction permettant de faire de l'ajax</span>
		   type<span style="color: #339933;">:</span> <span style="color: #3366CC;">&quot;POST&quot;</span><span style="color: #339933;">,</span> <span style="color: #006600; font-style: italic;">// methode de transmission des données au fichier php</span>
		   url<span style="color: #339933;">:</span> <span style="color: #3366CC;">&quot;login.php&quot;</span><span style="color: #339933;">,</span> <span style="color: #006600; font-style: italic;">// url du fichier php</span>
		   data<span style="color: #339933;">:</span> <span style="color: #3366CC;">&quot;login=&quot;</span><span style="color: #339933;">+</span>$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;#login&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">val</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">+</span><span style="color: #3366CC;">&quot;&amp;pass=&quot;</span><span style="color: #339933;">+</span>$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;#pass&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">val</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> <span style="color: #006600; font-style: italic;">// données à transmettre</span>
		   success<span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>msg<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span> <span style="color: #006600; font-style: italic;">// si l'appel a bien fonctionné</span>
				<span style="color: #000066; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span>msg<span style="color: #339933;">==</span><span style="color: #CC0000;">1</span><span style="color: #009900;">&#41;</span> <span style="color: #006600; font-style: italic;">// si la connexion en php a fonctionnée</span>
				<span style="color: #009900;">&#123;</span>
					$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;div#connexion&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">html</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;&lt;span id=<span style="color: #000099; font-weight: bold;">\&quot;</span>confirmMsg<span style="color: #000099; font-weight: bold;">\&quot;</span>&gt;Vous &amp;ecirc;tes maintenant connect&amp;eacute;.&lt;/span&gt;&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
					<span style="color: #006600; font-style: italic;">// on désactive l'affichage du formulaire et on affiche un message de bienvenue à la place</span>
				<span style="color: #009900;">&#125;</span>
				<span style="color: #000066; font-weight: bold;">else</span> <span style="color: #006600; font-style: italic;">// si la connexion en php n'a pas fonctionnée</span>
				<span style="color: #009900;">&#123;</span>
					$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;span#erreur&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">html</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;&lt;img src=<span style="color: #000099; font-weight: bold;">\&quot;</span>bomb.png<span style="color: #000099; font-weight: bold;">\&quot;</span> style=<span style="color: #000099; font-weight: bold;">\&quot;</span>float:left;<span style="color: #000099; font-weight: bold;">\&quot;</span> /&gt;&amp;nbsp;Erreur lors de la connexion, veuillez v&amp;eacute;rifier votre login et votre mot de passe.&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
					<span style="color: #006600; font-style: italic;">// on affiche un message d'erreur dans le span prévu à cet effet</span>
				<span style="color: #009900;">&#125;</span>
		   <span style="color: #009900;">&#125;</span>
		<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</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: #006600; font-style: italic;">// permet de rester sur la même page à la soumission du formulaire</span>
	<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p>
Enfin, il ne reste plus qu&#8217;à <strong>créer le fichier php (login.php)</strong> permettant de tester les paramètres de connexion en testant dans la base de données des membres, si le login et le mot de passe correspondent (ce code est ultra-simplifié, il n&#8217;est pas forcément très sécurisé <img src='http://blog.arnaud-k.fr/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' />  ). <strong>Si la connexion est validée, on créé un cookie</strong> (que l&#8217;on pourra tester par la suite avec la fonction &laquo;&nbsp;isset($_COOKIE[id])&nbsp;&raquo; ).<br />
Contenu du fichier login.php :
</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
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">// connexion avec la base de données</span>
<span style="color: #000088;">$link</span> <span style="color: #339933;">=</span> <span style="color: #990000;">mysql_connect</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;localhost&quot;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;root&quot;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;&quot;</span><span style="color: #009900;">&#41;</span> or <span style="color: #990000;">die</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Impossible de se connecter : &quot;</span> <span style="color: #339933;">.</span> <span style="color: #990000;">mysql_error</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #990000;">mysql_select_db</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;nomDeMaBase&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">// on exécute maintenant la requete sql pour tester si les parametres de connexion sont ok</span>
<span style="color: #000088;">$result</span> <span style="color: #339933;">=</span> <span style="color: #990000;">mysql_query</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;SELECT login, pass, id FROM membres WHERE login = '<span style="color: #006699; font-weight: bold;">$_POST[login]</span>' AND pass = '<span style="color: #006699; font-weight: bold;">$_POST[pass]</span>'&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$membre</span> <span style="color: #339933;">=</span> <span style="color: #990000;">mysql_fetch_assoc</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$result</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_POST</span><span style="color: #009900;">&#91;</span>login<span style="color: #009900;">&#93;</span><span style="color: #339933;">==</span><span style="color: #000088;">$membre</span><span style="color: #009900;">&#91;</span>login<span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">&amp;&amp;</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_POST</span><span style="color: #009900;">&#91;</span>pass<span style="color: #009900;">&#93;</span><span style="color: #339933;">==</span><span style="color: #000088;">$membre</span><span style="color: #009900;">&#91;</span>pass<span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
	<span style="color: #990000;">setcookie</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;id&quot;</span><span style="color: #339933;">,</span><span style="color: #000088;">$membre</span><span style="color: #009900;">&#91;</span>id<span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">// genere un cookie contenant l'id du membre</span>
	<span style="color: #990000;">setcookie</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;login&quot;</span><span style="color: #339933;">,</span><span style="color: #000088;">$membre</span><span style="color: #009900;">&#91;</span>login<span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">// genere un cookie contenant le login du membre		</span>
	<span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">&quot;1&quot;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">// on 'retourne' la valeur 1 au javascript si la connexion est bonne</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #b1b100;">else</span> 
<span style="color: #009900;">&#123;</span>
	<span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">&quot;0&quot;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">// on 'retourne' la valeur 0 au javascript si la connexion n'est pas bonne</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p>
C&#8217;est tout pour le premier tutorial AJAX/JQuery/PHP. Cela permet <strong>un premier contact avec AJAX</strong> qui peut être facilement mis en place grâce à JQuery (on économise beaucoup de lignes de codes par rapport au &laquo;&nbsp;JavaScript normal&nbsp;&raquo;&#8230;).</p>


<p>Pas encore de billet sur le même sujet !</p>]]></content:encoded>
			<wfw:commentRss>http://blog.arnaud-k.fr/2009/04/22/tutorial-connexion-en-ajax-avec-jquery-et-php/feed/</wfw:commentRss>
		<slash:comments>27</slash:comments>
		</item>
		<item>
		<title>Tutorial Plugin JQuery #3, menu déroulant : Droppy</title>
		<link>http://blog.arnaud-k.fr/2009/04/20/tutorial-plugin-jquery-menu-deroulant-droppy/</link>
		<comments>http://blog.arnaud-k.fr/2009/04/20/tutorial-plugin-jquery-menu-deroulant-droppy/#comments</comments>
		<pubDate>Mon, 20 Apr 2009 12:20:54 +0000</pubDate>
		<dc:creator>arnaud</dc:creator>
				<category><![CDATA[JQuery]]></category>
		<category><![CDATA[css]]></category>
		<category><![CDATA[droppy]]></category>
		<category><![CDATA[html]]></category>
		<category><![CDATA[plugin JQuery]]></category>

		<guid isPermaLink="false">http://blog.arnaud-k.fr/?p=271</guid>
		<description><![CDATA[Pour continuer avec les tuto sur les plugins JQuery, j&#8217;ai choisi de présenter aujourd&#8217;hui Droppy. Droppy (dont le nom provient d&#8217;un jeu de mot avec &#171;&#160;drop-down menu&#160;&#187;, menu déroulant en english) permet de faire très facilement un menu déroulant multi-niveau&#160;[...]</p> <p class="read-more"><a class="gray normal" href="http://blog.arnaud-k.fr/2009/04/20/tutorial-plugin-jquery-menu-deroulant-droppy/">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%2F04%2F20%2Ftutorial-plugin-jquery-menu-deroulant-droppy%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fblog.arnaud-k.fr%2F2009%2F04%2F20%2Ftutorial-plugin-jquery-menu-deroulant-droppy%2F&amp;source=arnaudk&amp;style=compact&amp;service=bit.ly&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
<p>Pour continuer avec <a href="http://blog.arnaud-k.fr/tag/plugin-jquery/">les tuto sur les plugins JQuery</a>, j&#8217;ai choisi de présenter aujourd&#8217;hui <a href="http://onehackoranother.com/projects/jquery/droppy/">Droppy</a>. Droppy (dont le nom provient d&#8217;un jeu de mot avec &laquo;&nbsp;drop-down menu&nbsp;&raquo;, menu déroulant en english) permet de faire très facilement <strong>un menu déroulant multi-niveau avec des effets d&#8217;apparition et de disparition</strong> très simples.</p>
<p><img class="aligncenter size-full wp-image-272" title="faire un menu déroulant avec Jquery : plugin droppy" src="http://blog.arnaud-k.fr/wp-content/uploads/2009/04/droppy.png" alt="faire un menu déroulant avec Jquery : plugin droppy" width="600" height="200" /></p>
<p>Pour celui pas vraiment de connaissances sont nécessaires. Il faut juste que le <strong>fichier html soit bien structuré</strong> pour éviter les bugs d&#8217;affichage.</p>
<p><a href="http://blog.arnaud-k.fr/pluginsJquery/Droppy/">Voir une démo du plugin JQuery.droppy</a></p>
<p>Comme à chaque fois, il faut commencer par charger le framwork JQuery suivi du plugin et du fichier contenant les styles css nécessaires au plugin (bien penser à mettre la bonne adresse pour le chargement des fichiers&#8230;)</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
</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;">type</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;text/javascript&quot;</span> <span style="color: #000066;">src</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js&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;">type</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;text/javascript&quot;</span> <span style="color: #000066;">src</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;js/jquery.droppy.js&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;">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;">media</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;screen&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;">href</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;js/droppy.css&quot;</span> <span style="color: #66cc66;">/</span>&gt;</span></pre></td></tr></table></div>

<p>
Il faut ensuite <strong>initialiser le plugin</strong> (à insérer dans votre fichier JavaScript perso ou dans la page html entre les balises &lt;script&gt;). <strong>&laquo;&nbsp;nav&nbsp;&raquo; correspond à l&#8217;id de la liste non ordonnée</strong> (&lt;ul&gt;) contenant le menu :
</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
</pre></td><td class="code"><pre class="javascript" style="font-family:monospace;">$<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>
    		$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'#nav'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">droppy</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p>
C&#8217;est maintenant dans le code html qu&#8217;il faut être attentif. <strong>Tout est basé sur les listes non ordonnées</strong> (&lt;ul&gt; et &lt;li&gt;). Le menu est contenu dans un premier ul qui a pour id &laquo;&nbsp;nav&nbsp;&raquo;. Chaque élément du menu est un lien contenu dans des li. Pour créer un sous-menu, il suffit d&#8217;encapsuler un autre ul (sans id) dans l&#8217;élément de liste (li). Un exemple devrait être plus clair <img src='http://blog.arnaud-k.fr/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' />  :
</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
25
26
27
</pre></td><td class="code"><pre class="html4strict" style="font-family:monospace;"><span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">ul</span> <span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;nav&quot;</span>&gt;</span>
		<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">li</span>&gt;</span> <span style="color: #808080; font-style: italic;">&lt;!-- premier élément du menu, n'a pas de sous-menu --&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>&gt;</span>Menu 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: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">li</span>&gt;</span>
&nbsp;
		<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">li</span>&gt;</span> <span style="color: #808080; font-style: italic;">&lt;!-- deuxième élément du menu, avec un sous-menu --&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>&gt;</span>Menu 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: #808080; font-style: italic;">&lt;!-- lien du menu --&gt;</span>
			<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">ul</span>&gt;</span> <span style="color: #808080; font-style: italic;">&lt;!-- début du sous-menu --&gt;</span>
				<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">li</span>&gt;</span> <span style="color: #808080; font-style: italic;">&lt;!-- premier élément du sous-menu --&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>&gt;</span>Sous-menu 2.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: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">li</span>&gt;</span>
&nbsp;
				<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">li</span>&gt;</span> <span style="color: #808080; font-style: italic;">&lt;!-- deuxième élément du sous-menu --&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>&gt;</span>Sous-menu 2.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: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">li</span>&gt;</span>
&nbsp;
				<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">li</span>&gt;</span> <span style="color: #808080; font-style: italic;">&lt;!-- troisième élément du sous-menu, avec un sous-sous-menu --&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>&gt;</span>Sous-menu 2.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;">ul</span>&gt;</span> <span style="color: #808080; font-style: italic;">&lt;!-- début du sous-sous-menu --&gt;</span>
						<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">li</span>&gt;&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>&gt;</span>Sous-sous-menu 2.3.1<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">a</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">li</span>&gt;</span>
						<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">li</span>&gt;&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>&gt;</span>Sous-sous-menu 2.3.2<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">a</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">li</span>&gt;</span>
						<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">li</span>&gt;&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>&gt;</span>Sous-sous-menu 2.3.3<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">a</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">li</span>&gt;</span>
					<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">ul</span>&gt;</span> <span style="color: #808080; font-style: italic;">&lt;!-- fin du sous-sous-menu --&gt;</span>
				<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">li</span>&gt;</span>
			<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">ul</span>&gt;</span> <span style="color: #808080; font-style: italic;">&lt;!-- fin du sous-menu --&gt;</span>
		<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">li</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">ul</span>&gt;</span></pre></td></tr></table></div>

<p>
<strong>Toutes les couleurs sont changeables</strong> dans le fichier CSS fourni en téléchargeant le <a href="http://blog.arnaud-k.fr/pluginsJquery/Droppy/">plugin</a>.
</p>
<p>
Je tiens à préciser que pour des raisons d&#8217;accessibilité, il est très souvent déconseillé de mettre plusieurs niveaux dans un menu déroulant, il vaut mieux ne mettre qu&#8217;un seul niveau de sous-menu.</p>


<p>Pas encore de billet sur le même sujet !</p>]]></content:encoded>
			<wfw:commentRss>http://blog.arnaud-k.fr/2009/04/20/tutorial-plugin-jquery-menu-deroulant-droppy/feed/</wfw:commentRss>
		<slash:comments>10</slash:comments>
		</item>
		<item>
		<title>Tutorial Plugin JQuery #2, défilement horizontal : Scrollable</title>
		<link>http://blog.arnaud-k.fr/2009/04/07/tutorial-plugin-jquery-defilement-horizontal-scrollable/</link>
		<comments>http://blog.arnaud-k.fr/2009/04/07/tutorial-plugin-jquery-defilement-horizontal-scrollable/#comments</comments>
		<pubDate>Tue, 07 Apr 2009 10:23:20 +0000</pubDate>
		<dc:creator>arnaud</dc:creator>
				<category><![CDATA[JQuery]]></category>
		<category><![CDATA[css]]></category>
		<category><![CDATA[html]]></category>
		<category><![CDATA[plugin JQuery]]></category>
		<category><![CDATA[scrollable]]></category>

		<guid isPermaLink="false">http://blog.arnaud-k.fr/?p=122</guid>
		<description><![CDATA[Toujours dans mes recherches de plugins pour JQuery (pour un projet perso cette fois-ci), je suis tombé sur ce bon plugin : Scrollable. Plugin assez aisé à mettre en place, mais il faut avoir quelques connaissances en CSS pour optimiser&#160;[...]</p> <p class="read-more"><a class="gray normal" href="http://blog.arnaud-k.fr/2009/04/07/tutorial-plugin-jquery-defilement-horizontal-scrollable/">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%2F04%2F07%2Ftutorial-plugin-jquery-defilement-horizontal-scrollable%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fblog.arnaud-k.fr%2F2009%2F04%2F07%2Ftutorial-plugin-jquery-defilement-horizontal-scrollable%2F&amp;source=arnaudk&amp;style=compact&amp;service=bit.ly&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
<p>Toujours dans mes recherches de plugins pour JQuery (pour un projet perso cette fois-ci), je suis tombé sur ce bon plugin : <a href="http://flowplayer.org/tools/scrollable.html">Scrollable</a>.</p>
<p><img class="aligncenter size-full wp-image-124" title="Plugin JQuery, défilement horizontal avec Scrollable" src="http://blog.arnaud-k.fr/wp-content/uploads/2009/04/scrollable1.png" alt="Plugin JQuery, défilement horizontal avec Scrollable" width="600" height="200" /></p>
<p>Plugin assez aisé à mettre en place, mais il faut avoir quelques connaissances en CSS pour optimiser au mieux l&#8217;utilisation du plugin.</p>
<p><a class="demo" title="Voir une démo du plugin JQuery.Scrollable" href="http://blog.arnaud-k.fr/scrollable.html">plugin JQuery Scrollable</a></p>
<p>Comme pour tous les plugins JQuery, il faut d&#8217;abord charger le framework JQuery avec de charger les fichiers du plugins : </p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
</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;">type</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;text/javascript&quot;</span> <span style="color: #000066;">src</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js&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;">type</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;text/javascript&quot;</span> <span style="color: #000066;">src</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;http://static.flowplayer.org/js/jquery.mousewheel.js&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;">type</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;text/javascript&quot;</span> <span style="color: #000066;">src</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;http://static.flowplayer.org/js/jquery.scrollable-1.0.2.min.js&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>

<p>
jquery.mousewheel.js permet d&#8217;ajouter le contrôle du défilement horizontal grâce à la molette de la souris oou à l&#8217;aide des flèches gauche et droite du clavier.
</p>
<p>Ensuite, il faut initialiser le plugin (à insérer dans votre fichier JavaScript perso ou dans la page html entre les balises <head> et </head>, ajouter avant le code <script type="text/javascript"> et après le code </script>) :</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
</pre></td><td class="code"><pre class="javascript" style="font-family:monospace;">$<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>
		<span style="color: #006600; font-style: italic;">// initialisation du plugin de defilement</span>
		$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;div.scrollable&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">scrollable</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#123;</span>
			size<span style="color: #339933;">:</span> <span style="color: #CC0000;">3</span><span style="color: #339933;">,</span>
			items<span style="color: #339933;">:</span> <span style="color: #3366CC;">'#thumbs'</span><span style="color: #339933;">,</span>  
			hoverClass<span style="color: #339933;">:</span> <span style="color: #3366CC;">'hover'</span><span style="color: #339933;">,</span>
			next<span style="color: #339933;">:</span> <span style="color: #3366CC;">'div.next'</span><span style="color: #339933;">,</span> 
			prev<span style="color: #339933;">:</span> <span style="color: #3366CC;">'div.prev'</span> 
		<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>	
<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p>Dans mon exemple, j&#8217;initialise le plugin avec quelques paramètres personnalisés : <strong>size</strong> définit le nombre d&#8217;éléments à afficher simultanément, <strong>hoverClass</strong> permet d&#8217;ajouter une classe (qui sera définie dans la feuille de style de la page) au survol de l&#8217;élément, <strong>next</strong> et <strong>prev</strong> correspondent aux liens de navigation pour faire avance ou reculer le défilement.
</p>
<p>Après, il faut prévoir l&#8217;affichage du contenu (html) qui va être défilé (le nombre d&#8217;éléments total sera aussi défini ici) :</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
25
26
27
28
29
30
31
32
33
</pre></td><td class="code"><pre class="html4strict" style="font-family:monospace;"><span style="color: #808080; font-style: italic;">&lt;!-- conteneur --&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;scrollable&quot;</span>&gt;</span>
&nbsp;
	<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">div</span> <span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;thumbs&quot;</span>&gt;</span>
&nbsp;
			<span style="color: #808080; font-style: italic;">&lt;!-- chaque element est contenu dans un bloc de type div --&gt;</span>
			<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">div</span>&gt;</span>
				<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">img</span> <span style="color: #000066;">src</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;photosExemples/mini/3.jpg&quot;</span> <span style="color: #000066;">alt</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;image 1&quot;</span> <span style="color: #66cc66;">/</span>&gt;</span>
&nbsp;
				<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">h3</span>&gt;&lt;<span style="color: #000000; font-weight: bold;">em</span>&gt;</span>1. <span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">em</span>&gt;</span>An example title<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">h3</span>&gt;</span>
&nbsp;
&nbsp;
				<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">p</span>&gt;</span>
					Lorem ipsum dolor sit amet, consectetur adipiscing elit. Proin et felis eget 
					tellus pharetra porttitor. Praesent dui arcu, egestas quis, adipiscing a.
				<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>
&nbsp;
		        <span style="color: #808080; font-style: italic;">&lt;!-- deuxieme element --&gt;</span>
			<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">div</span>&gt;</span>
				<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">img</span> <span style="color: #000066;">src</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;photosExemples/mini/4.jpg&quot;</span> <span style="color: #000066;">alt</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;image 2&quot;</span> <span style="color: #66cc66;">/</span>&gt;</span>
&nbsp;
				<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">h3</span>&gt;&lt;<span style="color: #000000; font-weight: bold;">em</span>&gt;</span>2. <span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">em</span>&gt;</span>An example title<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">h3</span>&gt;</span>
&nbsp;
				<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">p</span>&gt;</span>
&nbsp;
					Lorem ipsum dolor sit amet, consectetur adipiscing elit. Proin et felis eget 
					tellus pharetra porttitor. Praesent dui arcu, egestas quis, adipiscing a.
				<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>
<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>Enfin on peut appliquer des styles css aux éléments :</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
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
</pre></td><td class="code"><pre class="css" style="font-family:monospace;"><span style="color: #808080; font-style: italic;">/* element parent */</span>
div<span style="color: #6666ff;">.scrollable</span> <span style="color: #00AA00;">&#123;</span>  
	<span style="color: #000000; font-weight: bold;">position</span><span style="color: #00AA00;">:</span><span style="color: #993333;">relative</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">overflow</span><span style="color: #00AA00;">:</span><span style="color: #993333;">hidden</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">width</span><span style="color: #00AA00;">:</span> <span style="color: #933;">646px</span><span style="color: #00AA00;">;</span>	 
	<span style="color: #000000; font-weight: bold;">height</span><span style="color: #00AA00;">:</span><span style="color: #933;">300px</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">float</span><span style="color: #00AA00;">:</span><span style="color: #000000; font-weight: bold;">left</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span>
&nbsp;
<span style="color: #808080; font-style: italic;">/* 
	element parent pour les element a defiler, il faut absolument un grande largeur
*/</span>
<span style="color: #cc00cc;">#thumbs</span> <span style="color: #00AA00;">&#123;</span>	
	<span style="color: #000000; font-weight: bold;">position</span><span style="color: #00AA00;">:</span><span style="color: #993333;">absolute</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">width</span><span style="color: #00AA00;">:</span><span style="color: #933;">20000em</span><span style="color: #00AA00;">;</span>	
	<span style="color: #000000; font-weight: bold;">clear</span><span style="color: #00AA00;">:</span><span style="color: #993333;">both</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">border</span><span style="color: #00AA00;">:</span><span style="color: #933;">1px</span> <span style="color: #993333;">solid</span> <span style="color: #cc00cc;">#222</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span>
&nbsp;
<span style="color: #808080; font-style: italic;">/* un element seul */</span>
<span style="color: #cc00cc;">#thumbs</span> div <span style="color: #00AA00;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">float</span><span style="color: #00AA00;">:</span><span style="color: #000000; font-weight: bold;">left</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">width</span><span style="color: #00AA00;">:</span><span style="color: #933;">214px</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">height</span><span style="color: #00AA00;">:</span><span style="color: #933;">300px</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">background</span><span style="color: #00AA00;">:</span><span style="color: #cc00cc;">#333</span> <span style="color: #993333;">url</span><span style="color: #00AA00;">&#40;</span><span style="color: #ff0000; font-style: italic;">photosExemples/fond.png</span><span style="color: #00AA00;">&#41;</span> <span style="color: #993333;">repeat-x</span> <span style="color: #cc66cc;">0</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">color</span><span style="color: #00AA00;">:</span><span style="color: #cc00cc;">#fff</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">border-left</span><span style="color: #00AA00;">:</span><span style="color: #933;">1px</span> <span style="color: #993333;">solid</span> <span style="color: #cc00cc;">#333</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">cursor</span><span style="color: #00AA00;">:</span><span style="color: #993333;">pointer</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span>
&nbsp;
<span style="color: #808080; font-style: italic;">/* style au survol */</span>
<span style="color: #cc00cc;">#thumbs</span> div<span style="color: #6666ff;">.hover</span> <span style="color: #00AA00;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">background-color</span><span style="color: #00AA00;">:</span><span style="color: #cc00cc;">#444</span><span style="color: #00AA00;">;</span>	
<span style="color: #00AA00;">&#125;</span>
&nbsp;
<span style="color: #808080; font-style: italic;">/* style au survol */</span>
<span style="color: #cc00cc;">#thumbs</span> div<span style="color: #6666ff;">.hover</span> h3 <span style="color: #00AA00;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">background</span><span style="color: #00AA00;">:</span><span style="color: #cc00cc;">#797979</span> <span style="color: #993333;">url</span><span style="color: #00AA00;">&#40;</span><span style="color: #ff0000; font-style: italic;">photosExemples/fond-h3-hover.png</span><span style="color: #00AA00;">&#41;</span> <span style="color: #993333;">no-repeat</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span>
&nbsp;
<span style="color: #808080; font-style: italic;">/* style quand un element est cliqué */</span>
<span style="color: #cc00cc;">#thumbs</span> div<span style="color: #6666ff;">.active</span> <span style="color: #00AA00;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">background-color</span><span style="color: #00AA00;">:</span><span style="color: #cc00cc;">#066</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">cursor</span><span style="color: #00AA00;">:</span><span style="color: #993333;">default</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span>
&nbsp;
<span style="color: #808080; font-style: italic;">/* styles à personnaliser selon votre contenu */</span>
<span style="color: #cc00cc;">#thumbs</span> h3<span style="color: #00AA00;">,</span> <span style="color: #cc00cc;">#thumbs</span> p<span style="color: #00AA00;">,</span> <span style="color: #cc00cc;">#thumbs</span> span <span style="color: #00AA00;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">margin</span><span style="color: #00AA00;">:</span><span style="color: #933;">13px</span><span style="color: #00AA00;">;</span>		
	<span style="color: #000000; font-weight: bold;">font-family</span><span style="color: #00AA00;">:</span><span style="color: #ff0000;">&quot;bitstream vera sans&quot;</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;">13px</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">color</span><span style="color: #00AA00;">:</span><span style="color: #cc00cc;">#fff</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span>
&nbsp;
<span style="color: #cc00cc;">#thumbs</span> h3 <span style="color: #00AA00;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">background</span><span style="color: #00AA00;">:</span><span style="color: #cc00cc;">#353535</span> <span style="color: #993333;">url</span><span style="color: #00AA00;">&#40;</span>photosExemples/fond-h3.png<span style="color: #00AA00;">&#41;</span> <span style="color: #993333;">no-repeat</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">width</span><span style="color: #00AA00;">:</span><span style="color: #933;">100%</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">padding</span><span style="color: #00AA00;">:</span><span style="color: #933;">8px</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">padding-left</span><span style="color: #00AA00;">:</span><span style="color: #933;">35px</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">margin-left</span><span style="color: #00AA00;">:</span><span style="color: #933;">0px</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">margin-top</span><span style="color: #00AA00;">:</span><span style="color: #933;">0px</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span>
&nbsp;
<span style="color: #cc00cc;">#thumbs</span> h3 em <span style="color: #00AA00;">&#123;</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;">color</span><span style="color: #00AA00;">:</span><span style="color: #cc00cc;">#ffa800</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span>
&nbsp;
div<span style="color: #6666ff;">.prev</span> <span style="color: #00AA00;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">color</span><span style="color: #00AA00;">:</span><span style="color: #cc00cc;">#ffa800</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;">1.6em</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;">bold</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">cursor</span><span style="color: #00AA00;">:</span><span style="color: #993333;">pointer</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">margin-top</span><span style="color: #00AA00;">:</span><span style="color: #933;">150px</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">float</span><span style="color: #00AA00;">:</span><span style="color: #000000; font-weight: bold;">left</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span>
div<span style="color: #6666ff;">.next</span> <span style="color: #00AA00;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">color</span><span style="color: #00AA00;">:</span><span style="color: #cc00cc;">#ffa800</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;">1.6em</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;">bold</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">cursor</span><span style="color: #00AA00;">:</span><span style="color: #993333;">pointer</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">margin-top</span><span style="color: #00AA00;">:</span><span style="color: #933;">150px</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">float</span><span style="color: #00AA00;">:</span><span style="color: #000000; font-weight: bold;">left</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span></pre></td></tr></table></div>

<p>N&#8217;hésite pas à m&#8217;envoyer un lien (ou à le mettre dans les commentaires) si tu utilises le plugin grâce à mon (petit) tuto, je n&#8217;hésiterai pas à le publier ici !</p>


<p>Pas encore de billet sur le même sujet !</p>]]></content:encoded>
			<wfw:commentRss>http://blog.arnaud-k.fr/2009/04/07/tutorial-plugin-jquery-defilement-horizontal-scrollable/feed/</wfw:commentRss>
		<slash:comments>10</slash:comments>
		</item>
	</channel>
</rss>

