<?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>mysrc.de &#187; JS-Framework Tutorials</title> <atom:link href="http://www.mysrc.de/category/js-framework-tutorials/feed/" rel="self" type="application/rss+xml" /><link>http://www.mysrc.de</link> <description>- jQuery, MooTools, HTML5, AJAX</description> <lastBuildDate>Tue, 14 Jun 2011 08:24:25 +0000</lastBuildDate> <language>en</language> <sy:updatePeriod>hourly</sy:updatePeriod> <sy:updateFrequency>1</sy:updateFrequency> <generator>http://wordpress.org/?v=3.0.1</generator> <item><title>IxEdit &#8211; jQuery the easy way</title><link>http://www.mysrc.de/jquery/ixedit-jquery-the-easy-way/</link> <comments>http://www.mysrc.de/jquery/ixedit-jquery-the-easy-way/#comments</comments> <pubDate>Sun, 06 Sep 2009 13:43:37 +0000</pubDate> <dc:creator>Stefan Huissel</dc:creator> <category><![CDATA[JS-Framework Tutorials]]></category> <category><![CDATA[jQuery]]></category> <category><![CDATA[Coding]]></category> <category><![CDATA[jQuery UI]]></category> <guid
isPermaLink="false">http://www.mysrc.de/?p=860</guid> <description><![CDATA[Mit IxEdit ist es möglich JQuery Funktionen ohne JS-Programmierung direkt on-the-Fly im Browser den gewünschten HTML Elementen zuzuweißen. Statt vieler weiterer Worte das Demo Video: Wenn ihr es ausprobieren wollt, so gehts: 1. Als erstes die notwendigen IxEdit Dateien von IxEdit herunterladen 2. Das das Google Gears Firefox Addon Google Gears Portable installieren und Browser [...]]]></description> <content:encoded><![CDATA[<p>Mit <a
href="http://www.ixedit.com/" target="blank">IxEdit</a> ist es möglich JQuery Funktionen <strong>ohne JS-Programmierung</strong> direkt <strong>on-the-Fly</strong> im Browser den gewünschten HTML Elementen zuzuweißen. Statt vieler weiterer Worte das Demo Video:</p><p><object
width="425" height="344"><param
name="movie" value="http://www.youtube.com/v/OblVz5-D8EI&#038;rel=0&#038;color1=0xb1b1b1&#038;color2=0xcfcfcf&#038;hl=ja&#038;feature=player_embedded&#038;fs=1"></param><param
name="allowFullScreen" value="true"></param><param
name="allowScriptAccess" value="always"></param><embed
src="http://www.youtube.com/v/OblVz5-D8EI&#038;rel=0&#038;color1=0xb1b1b1&#038;color2=0xcfcfcf&#038;hl=ja&#038;feature=player_embedded&#038;fs=1" type="application/x-shockwave-flash" allowfullscreen="true" allowScriptAccess="always" width="425" height="344"></embed></object></p><p>Wenn ihr es ausprobieren wollt, so gehts:</p><p>1. Als erstes die notwendigen IxEdit Dateien von <a
href="http://www.ixedit.com/download/" target="blank">IxEdit</a> herunterladen</p><p>2. Das das Google Gears Firefox Addon <a
href="https://addons.mozilla.org/de/firefox/addon/13492" target="blank">Google Gears Portable</a> installieren und Browser neu starten</p><p>3. Im entpackten IxEdit Ordner die index.html aufrufen</p><p>Nun könnt ihr den bestehenden HTML Elementen nach belieben jQuery Events zuweißen. Das Tool ist <strong>ideal zum Experimentieren</strong> mit verschiedenen Effekten und auch allgemein um sich einen besseren Überblick über die Möglichkeiten von JQuery zu verschaffen.</p><p>Nachdem alle gewünschten Effekte integriert sind, wird mit <strong>der Deploy-Funktion</strong> der entsprechende jQuery Code angezeigt, der dann in das Quelldokument kopiert werden kann.</p><p>Easy oder!?</p><h3  class="related_post_title">Ähnliche Artikel</h3><ul
class="related_post"><li>16. Oktober 2009 -- <a
href="http://www.mysrc.de/jquery/jquery-accessible-ria-widgets-fur-jedermann/" title="jQuery &#8211; Accessible-RIA &#8211; Widgets für jedermann">jQuery &#8211; Accessible-RIA &#8211; Widgets für jedermann</a></li><li>27. Juli 2009 -- <a
href="http://www.mysrc.de/jquery/jquery-tutorial-closing-an-accordion-automatically/" title="jQuery Tutorial &#8211; Closing an Accordion automatically">jQuery Tutorial &#8211; Closing an Accordion automatically</a></li><li>6. Juni 2009 -- <a
href="http://www.mysrc.de/jquery/tools-fur-jquery-ein-plugin-ui-elemente/" title="Tools für jQuery &#8211; Ein Plugin UI Elemente">Tools für jQuery &#8211; Ein Plugin UI Elemente</a></li></ul>]]></content:encoded> <wfw:commentRss>http://www.mysrc.de/jquery/ixedit-jquery-the-easy-way/feed/</wfw:commentRss> <slash:comments>1</slash:comments> </item> <item><title>jQuery Tutorial &#8211; Closing an Accordion automatically</title><link>http://www.mysrc.de/jquery/jquery-tutorial-closing-an-accordion-automatically/</link> <comments>http://www.mysrc.de/jquery/jquery-tutorial-closing-an-accordion-automatically/#comments</comments> <pubDate>Mon, 27 Jul 2009 17:10:57 +0000</pubDate> <dc:creator>Stefan Huissel</dc:creator> <category><![CDATA[JS-Framework Tutorials]]></category> <category><![CDATA[Javascript]]></category> <category><![CDATA[jQuery]]></category> <category><![CDATA[CSS Framework]]></category> <category><![CDATA[jQuery UI]]></category> <category><![CDATA[Tutorial]]></category> <guid
isPermaLink="false">http://www.mysrc.de/?p=782</guid> <description><![CDATA[Entscheidender Punkt für die Umsetzung dabei sind Events. Die jQuery API bietet eine Menge verschiedener Events für die Registierung von Mousebewegungen. In unserem Beispiel sorgen wir nun dafür, dass sich nach dem Verlassen des Accordions mit dem Cursor das letzte geöffnete Accordion Div wieder schließt. Also, erstmal zum HTML-Aufbau ?View Code HTML1 2 3 4 [...]]]></description> <content:encoded><![CDATA[<p>Entscheidender Punkt für die Umsetzung dabei sind <strong>Events</strong>. Die <strong>jQuery API</strong> bietet eine Menge verschiedener Events für die Registierung von Mousebewegungen.<br
/> In unserem Beispiel sorgen wir nun dafür, dass sich nach dem Verlassen des Accordions mit dem Cursor das letzte geöffnete Accordion Div wieder schließt.</p><p>Also, erstmal zum HTML-Aufbau</p><div
class="wp_codebox_msgheader"><span
class="right"><sup><a
href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span
style="color: #99cc00">?</span></a></sup></span><span
class="left"><a
href="javascript:;" onclick="javascript:showCodeTxt('p782code4'); return false;">View Code</a> HTML</span><div
class="codebox_clear"></div></div><div
class="wp_codebox"><table><tr
id="p7824"><td
class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
</pre></td><td
class="code" id="p782code4"><pre class="html" style="font-family:monospace;">&nbsp;
&lt;h2 class=&quot;demoHeaders&quot;&gt;Accordion&lt;/h2&gt;
&lt;div id=&quot;accordion&quot;&gt;
	&lt;div&gt;
	&lt;h3&gt;&lt;a href=&quot;#&quot;&gt;First&lt;/a&gt;&lt;/h3&gt;
		&lt;div&gt;Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet.&lt;/div&gt;
	           &lt;/div&gt;
	&lt;div&gt;
		&lt;h3&gt;&lt;a href=&quot;#&quot;&gt;Second&lt;/a&gt;&lt;/h3&gt;
		&lt;div&gt;Phasellus mattis tincidunt nibh.&lt;/div&gt;
	&lt;/div&gt;
	&lt;div&gt;
		&lt;h3&gt;&lt;a href=&quot;#&quot;&gt;Third&lt;/a&gt;&lt;/h3&gt;
		&lt;div&gt;Nam dui erat, auctor a, dignissim quis.&lt;/div&gt;
	&lt;/div&gt;
&lt;/div&gt;</pre></td></tr></table></div><p>Das ist der Standardaufbau des Accoridons aus <a
href="http://jqueryui.com/demos/accordion/">jQuery UI</a>. Das CSS entstammt dem <a
href="http://jqueryui.com/docs/Theming/API">jQuery UI CSS Framework</a>.<br
/> Damit können Themes einfach, im Prinzip durch eine standardisierte Benamung von Elementen, ausgetauscht werden.</p><p>Nun zum Javascript Code. Er beinhaltet den Aufruf des Accordions und die Registrierung der Mouseevents.<br
/> Wir wollen das Accordion erst nach einer kleinen Verzögerung schließen, deshalb benutzen wie die Funktion <strong>setTimout</strong>. Falls der Benutzer innhalb dieser Zeit wieder mit dem Cursor über das Accordion fährt, muss dieser Timeout abgebrochen werden. Deshalb speichern wir<br
/> das Timeout-Objekt in einer globalen javascript Variabeln (<strong>tObj</strong>). Mittels der Funktion <strong>clearTimeout</strong> wird dieser Timout nun vorzeitig ohne Aufruf der Callback-Funktion beendet.</p><div
class="wp_codebox_msgheader"><span
class="right"><sup><a
href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span
style="color: #99cc00">?</span></a></sup></span><span
class="left"><a
href="javascript:;" onclick="javascript:showCodeTxt('p782code5'); return false;">View Code</a> JAVASCRIPT</span><div
class="codebox_clear"></div></div><div
class="wp_codebox"><table><tr
id="p7825"><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" id="p782code5"><pre class="javascript" style="font-family:monospace;"><span style="color: #339933;">&lt;</span>script type<span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;text/javascript&quot;</span><span style="color: #339933;">&gt;</span>
	<span style="color: #003366; font-weight: bold;">var</span> tObj<span style="color: #339933;">;</span>
&nbsp;
	$<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;">// simple accordion with special markup</span>
		$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'#accordion'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">accordion</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#123;</span>
			header<span style="color: #339933;">:</span> <span style="color: #3366CC;">'h3'</span><span style="color: #339933;">,</span>
			active<span style="color: #339933;">:</span> <span style="color: #3366CC;">'.selected'</span><span style="color: #339933;">,</span>
			collapsible<span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">true</span><span style="color: #339933;">,</span>
			autoHeight<span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">false</span>
		<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
		$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;#accordion&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">mouseleave</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>
		   	tObj<span style="color: #339933;">=</span>setTimeout<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;menu.accordion('activate', active);&quot;</span><span style="color: #339933;">,</span><span style="color: #CC0000;">3000</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>
&nbsp;
		$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;#accordion&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">mouseenter</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>
	     		clearTimeout<span style="color: #009900;">&#40;</span>tObj<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>
&nbsp;
	<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #339933;">&lt;/</span>script<span style="color: #339933;">&gt;</span></pre></td></tr></table></div><p>Da das Accordion in das Div mit der id &#8220;accordion&#8221; gehüllt ist, genügt es uns vollkommen die Events ebenfalls auf dieses Div zu legen.<br
/> Es bietet sich an die zwei Mousevents mittels Punktoperator zu verknüpfen. Die Funktionalität bleibt die gleiche, allerdings wird eine <strong>DOM Operation weniger</strong> ausgeführt. Was sich vor allem in Schleifen deutlich bemerkbar macht.<br
/> Verkettet sähe die Anweisung so aus:</p><div
class="wp_codebox_msgheader"><span
class="right"><sup><a
href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span
style="color: #99cc00">?</span></a></sup></span><span
class="left"><a
href="javascript:;" onclick="javascript:showCodeTxt('p782code6'); return false;">View Code</a> JAVASCRIPT</span><div
class="codebox_clear"></div></div><div
class="wp_codebox"><table><tr
id="p7826"><td
class="line_numbers"><pre>1
2
3
4
5
</pre></td><td
class="code" id="p782code6"><pre class="javascript" style="font-family:monospace;">	$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;#accordion&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">mouseleave</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>
		tObj<span style="color: #339933;">=</span>setTimeout<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;menu.accordion('activate', 'active');&quot;</span><span style="color: #339933;">,</span><span style="color: #CC0000;">3000</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: #660066;">mouseenter</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>
	    	clearTimeout<span style="color: #009900;">&#40;</span>tObj<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>Ein Beispiel dazu findet unter in unserem <a
href="http://www.mysrc.de/demo/accordion/">Demobereich</a>.</p><p>And kind regards to Fabian Hallstein for his idea&#8230;</p><h3  class="related_post_title">Ähnliche Artikel</h3><ul
class="related_post"><li>12. November 2009 -- <a
href="http://www.mysrc.de/jquery/jquery-prasentationen-fur-ein-besseres-verstandnis/" title="jQuery Präsentationen für ein besseres Verständnis">jQuery Präsentationen für ein besseres Verständnis</a></li><li>16. Oktober 2009 -- <a
href="http://www.mysrc.de/jquery/jquery-accessible-ria-widgets-fur-jedermann/" title="jQuery &#8211; Accessible-RIA &#8211; Widgets für jedermann">jQuery &#8211; Accessible-RIA &#8211; Widgets für jedermann</a></li><li>30. Juni 2009 -- <a
href="http://www.mysrc.de/allgemein/jquery-mypass-password-hiding-iphone-style/" title="jQuery myPass &#8211; password hiding iPhone-Style">jQuery myPass &#8211; password hiding iPhone-Style</a></li></ul>]]></content:encoded> <wfw:commentRss>http://www.mysrc.de/jquery/jquery-tutorial-closing-an-accordion-automatically/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>Formulare mit AJAX und jQuery &#8211; Ein kleines Tutorial</title><link>http://www.mysrc.de/jquery/formulare-mit-ajax-und-jquery-ein-kleines-tutorial/</link> <comments>http://www.mysrc.de/jquery/formulare-mit-ajax-und-jquery-ein-kleines-tutorial/#comments</comments> <pubDate>Sun, 19 Apr 2009 14:52:54 +0000</pubDate> <dc:creator>Stefan Huissel</dc:creator> <category><![CDATA[AJAX]]></category> <category><![CDATA[JS-Framework Tutorials]]></category> <category><![CDATA[jQuery]]></category> <category><![CDATA[Forms]]></category> <category><![CDATA[Tutorial]]></category> <guid
isPermaLink="false">http://www.mysrc.de/?p=394</guid> <description><![CDATA[AJAX ist eine vom Prinzip her sehr einfache Technologie. Request mit JS abschicken, Anfrage mit serverseitigem Skript verarbeiten und Ergebnis wieder im Browser ausgeben bzw. anzeigen. Allerdings steckt der Teufel wie immer im Detail. Dieser Post ist eine kleine Anleitung wie man AJAX mit einem Formular einsetzen kann. Weit einfacher ist dies mit der Verwendung [...]]]></description> <content:encoded><![CDATA[<p>AJAX ist eine vom Prinzip her sehr einfache Technologie. Request mit JS abschicken, Anfrage mit serverseitigem Skript verarbeiten und Ergebnis wieder im Browser ausgeben bzw. anzeigen. Allerdings steckt der Teufel wie immer im Detail. Dieser Post ist eine kleine Anleitung wie man <strong>AJAX mit einem Formular</strong> einsetzen kann. Weit einfacher ist dies mit der Verwendung eines JS-Frameworks, hier jQuery.</p><p>So zunächste einmal der Standardaufbau in HTML für ein Formular.</p><div
class="wp_codebox_msgheader"><span
class="right"><sup><a
href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span
style="color: #99cc00">?</span></a></sup></span><span
class="left"><a
href="javascript:;" onclick="javascript:showCodeTxt('p394code10'); return false;">View Code</a> HTML</span><div
class="codebox_clear"></div></div><div
class="wp_codebox"><table><tr
id="p39410"><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" id="p394code10"><pre class="html" style="font-family:monospace;">&lt;div class=&quot;block&quot;&gt;
&lt;div class=&quot;done&quot;&gt;
&lt;b&gt;Vielen Dank. Wir haben Ihre Anfrage erhalten&lt;/b&gt;
&lt;/div&gt;
	&lt;div class=&quot;myForm&quot;&gt;
	&lt;form method=&quot;post&quot; action=&quot;saveData.php&quot;&gt;
	&lt;div class=&quot;input&quot;&gt;
		&lt;label&gt;Name&lt;/label&gt;
		&lt;input type=&quot;text&quot; name=&quot;name&quot; class=&quot;text&quot; /&gt;
	&lt;/div&gt;
	&lt;div class=&quot;input&quot;&gt;
		&lt;label&gt;Email&lt;/label&gt;
		&lt;input type=&quot;text&quot; name=&quot;email&quot; class=&quot;text&quot; /&gt;
	&lt;/div&gt;
	&lt;div class=&quot;input&quot;&gt;
		&lt;label&gt;Kommentar&lt;/label&gt;
		&lt;textarea name=&quot;kommentar&quot; class=&quot;text textarea&quot; /&gt;&lt;/textarea&gt;
	&lt;/div&gt;
	&lt;div class=&quot;input&quot;&gt;
&nbsp;
		&lt;input type=&quot;submit&quot; id=&quot;submit&quot;/&gt;
		&lt;div class=&quot;loading_icon&quot;&gt;&lt;/div&gt;
	&lt;/div&gt;
	&lt;/form&gt;
	&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;clear&quot;&gt;&lt;/div&gt;</pre></td></tr></table></div><p>Nichts besonderes. Jedes Input Feld ist noch mit einem beschreibenden Label versehen. Zur einfacheren Gestaltung sind die einzelnen inputs mit ihren Labeln in einem div gehüllt. Die Divs mit der Klasse &#8220;loading_icon&#8221; und &#8220;done&#8221; sind zum Startzeitpunkt unsichtbar.<br
/> Das CSS dazu könnte man so umsetzen:</p><div
class="wp_codebox_msgheader"><span
class="right"><sup><a
href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span
style="color: #99cc00">?</span></a></sup></span><span
class="left"><a
href="javascript:;" onclick="javascript:showCodeTxt('p394code11'); return false;">View Code</a> CSS</span><div
class="codebox_clear"></div></div><div
class="wp_codebox"><table><tr
id="p39411"><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
</pre></td><td
class="code" id="p394code11"><pre class="css" style="font-family:monospace;">body<span style="color: #00AA00;">&#123;</span>
        <span style="color: #000000; font-weight: bold;">text-align</span><span style="color: #00AA00;">:</span><span style="color: #993333;">center</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span>
&nbsp;
<span style="color: #6666ff;">.loading_icon</span> <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;">right</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">background</span><span style="color: #00AA00;">:</span><span style="color: #993333;">url</span><span style="color: #00AA00;">&#40;</span><span style="color: #ff0000; font-style: italic;">ajax-loader.gif</span><span style="color: #00AA00;">&#41;</span> <span style="color: #993333;">no-repeat</span> <span style="color: #933;">1px</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">height</span><span style="color: #00AA00;">:</span><span style="color: #933;">30px</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">width</span><span style="color: #00AA00;">:</span><span style="color: #933;">30px</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">display</span><span style="color: #00AA00;">:</span><span style="color: #993333;">none</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span>
<span style="color: #6666ff;">.done</span> <span style="color: #00AA00;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">background</span><span style="color: #00AA00;">:</span><span style="color: #993333;">url</span><span style="color: #00AA00;">&#40;</span><span style="color: #ff0000; font-style: italic;">iconIdea.gif</span><span style="color: #00AA00;">&#41;</span> <span style="color: #993333;">no-repeat</span> <span style="color: #933;">2px</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;">20px</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;">12px</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">width</span><span style="color: #00AA00;">:</span><span style="color: #933;">70%</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">margin</span><span style="color: #00AA00;">:</span><span style="color: #933;">20px</span> <span style="color: #993333;">auto</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">display</span><span style="color: #00AA00;">:</span><span style="color: #993333;">none</span>
<span style="color: #00AA00;">&#125;</span>
&nbsp;
.<span style="color: #000000; font-weight: bold;">clear</span> <span style="color: #00AA00;">&#123;</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;">&#125;</span>
&nbsp;
.<span style="color: #993333;">block</span> <span style="color: #00AA00;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">width</span><span style="color: #00AA00;">:</span><span style="color: #933;">400px</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">margin</span><span style="color: #00AA00;">:</span><span style="color: #cc66cc;">0</span> <span style="color: #993333;">auto</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">text-align</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>
<span style="color: #6666ff;">.input</span> <span style="color: #00AA00;">*</span> <span style="color: #00AA00;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">padding</span><span style="color: #00AA00;">:</span><span style="color: #933;">5px</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">margin</span><span style="color: #00AA00;">:</span><span style="color: #933;">2px</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;">12px</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span>
<span style="color: #6666ff;">.input</span> label <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;">75px</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">font-weight</span><span style="color: #00AA00;">:</span><span style="color: #cc66cc;">700</span>
<span style="color: #00AA00;">&#125;</span>
<span style="color: #6666ff;">.input</span> input.<span style="color: #993333;">text</span> <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;">270px</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;">20px</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span>
<span style="color: #6666ff;">.input</span> <span style="color: #6666ff;">.textarea</span> <span style="color: #00AA00;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">height</span><span style="color: #00AA00;">:</span><span style="color: #933;">120px</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">width</span><span style="color: #00AA00;">:</span><span style="color: #933;">270px</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;">20px</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span>
&nbsp;
<span style="color: #6666ff;">.input</span> <span style="color: #cc00cc;">#submit</span> <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;">right</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">margin-right</span><span style="color: #00AA00;">:</span><span style="color: #933;">10px</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span></pre></td></tr></table></div><p>So. Nun können  wir uns endlich um den AJAX-Request kümmern. Schauen wir uns an wie wir die Daten nun weiter verarbeiten und an das PHP-Skript weiterleiten.</p><div
class="wp_codebox_msgheader"><span
class="right"><sup><a
href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span
style="color: #99cc00">?</span></a></sup></span><span
class="left"><a
href="javascript:;" onclick="javascript:showCodeTxt('p394code12'); return false;">View Code</a> JAVASCRIPT</span><div
class="codebox_clear"></div></div><div
class="wp_codebox"><table><tr
id="p39412"><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
</pre></td><td
class="code" id="p394code12"><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;">//click event für submit button</span>
  <span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'#submit'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">click</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>
&nbsp;
  <span style="color: #006600; font-style: italic;">//Daten von den HTML Feldern in JS-Vars übersetzen</span>
  <span style="color: #003366; font-weight: bold;">var</span> <span style="color: #000066;">name</span> <span style="color: #339933;">=</span> $<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'input[name=name]'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #003366; font-weight: bold;">var</span> email <span style="color: #339933;">=</span> $<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'input[name=email]'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #003366; font-weight: bold;">var</span> website <span style="color: #339933;">=</span> $<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'input[name=website]'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #003366; font-weight: bold;">var</span> comment <span style="color: #339933;">=</span> $<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'textarea[name=comment]'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
  <span style="color: #006600; font-style: italic;">//die Daten sollen per GET an das PHP Skript weitergeleitet werden. Dafür bauen wir einen </span>
  <span style="color: #006600; font-style: italic;">//String</span>
  <span style="color: #003366; font-weight: bold;">var</span> data <span style="color: #339933;">=</span> <span style="color: #3366CC;">'name='</span> <span style="color: #339933;">+</span> <span style="color: #000066;">name</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;">'&amp;email='</span> <span style="color: #339933;">+</span> email.<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;">'&amp;comment='</span>  <span style="color: #339933;">+</span> encodeURIComponent<span style="color: #009900;">&#40;</span>kommentar.<span style="color: #660066;">val</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
  <span style="color: #006600; font-style: italic;">//alle Textfelder deaktivieren</span>
  $<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'.text'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">attr</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'disabled'</span><span style="color: #339933;">,</span><span style="color: #3366CC;">'true'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
  <span style="color: #006600; font-style: italic;">//Icon während des Requests einblenden</span>
  $<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'.loading_icon'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">show</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
  <span style="color: #006600; font-style: italic;">//Request abschicken</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;">//Ort des Skriptes in dem die per GET übertragenen Daten verarbeitet werden sollen</span>
	url<span style="color: #339933;">:</span> <span style="color: #3366CC;">&quot;saveData.php&quot;</span><span style="color: #339933;">,</span>
	<span style="color: #006600; font-style: italic;">//Angabe der GET Methode, auch POST wäre möglich. Allerdings nur sinnvoll</span>
        <span style="color: #006600; font-style: italic;">//bei größeren Datenmengen</span>
	type<span style="color: #339933;">:</span> <span style="color: #3366CC;">&quot;GET&quot;</span><span style="color: #339933;">,</span>
	<span style="color: #006600; font-style: italic;">//Daten die gesendet werden sollen			</span>
	data<span style="color: #339933;">:</span> data<span style="color: #339933;">,</span>
&nbsp;
	<span style="color: #006600; font-style: italic;">//bei Antwort des Requests (Response)</span>
	success<span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">function</span> <span style="color: #009900;">&#40;</span>reqCode<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
	<span style="color: #006600; font-style: italic;">//wenn saveData.php true bzw. den Status 1 zurückliefert</span>
		<span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>reqCode<span style="color: #339933;">==</span><span style="color: #CC0000;">1</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
			<span style="color: #006600; font-style: italic;">//verstecken des Formulars</span>
			$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'.form'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">fadeOut</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'slow'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			<span style="color: #006600; font-style: italic;">//anzeigen der Erfolgsmeldung</span>
			$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'.done'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">fadeIn</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'slow'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
		<span style="color: #006600; font-style: italic;">//wenn der Request eine Form von false zurückschickt, Fehler ausgeben.</span>
		<span style="color: #009900;">&#125;</span> <span style="color: #000066; font-weight: bold;">else</span><span style="color: #009900;">&#123;</span>
                        <span style="color: #000066;">alert</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'Fehler beim Abschicken des Formulares.'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</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>
&nbsp;
	<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;">//der return wird benötigt, damit das Formular nicht tatsächlich abgeschickt wird und         </span>
        <span style="color: #006600; font-style: italic;">//sich nicht wie ein normales Form mit Seiten Refresh verhält.</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>All magic is done <img
src='http://www.mysrc.de/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> &#8230;</p><p><a
href="http://www.mysrc.de/demo/form_example/" target="blank">Demo</a></p><h3  class="related_post_title">Ähnliche Artikel</h3><ul
class="related_post"><li>12. August 2009 -- <a
href="http://www.mysrc.de/jquery/jquery-form-plugin-do-some-ajax-magic-easily/" title="jQuery Form Plugin &#8211; Do some AJAX magic easily">jQuery Form Plugin &#8211; Do some AJAX magic easily</a></li><li>30. Juni 2009 -- <a
href="http://www.mysrc.de/allgemein/jquery-mypass-password-hiding-iphone-style/" title="jQuery myPass &#8211; password hiding iPhone-Style">jQuery myPass &#8211; password hiding iPhone-Style</a></li><li>16. Mai 2009 -- <a
href="http://www.mysrc.de/jquery/jquery-formulare-validieren-ein-uberblick/" title="jQuery Formulare validieren &#8211; Ein Überblick">jQuery Formulare validieren &#8211; Ein Überblick</a></li></ul>]]></content:encoded> <wfw:commentRss>http://www.mysrc.de/jquery/formulare-mit-ajax-und-jquery-ein-kleines-tutorial/feed/</wfw:commentRss> <slash:comments>27</slash:comments> </item> <item><title>jQuery versus CSS</title><link>http://www.mysrc.de/jquery/jquery-versus-css/</link> <comments>http://www.mysrc.de/jquery/jquery-versus-css/#comments</comments> <pubDate>Wed, 15 Apr 2009 21:34:57 +0000</pubDate> <dc:creator>Stefan Huissel</dc:creator> <category><![CDATA[JS-Framework Tutorials]]></category> <category><![CDATA[jQuery]]></category> <category><![CDATA[CSS3]]></category> <guid
isPermaLink="false">http://www.mysrc.de/?p=347</guid> <description><![CDATA[An einem kleinen Beispiel soll gezeigt werden inwiefern CSS und ein JS-Framework gleiche Funktionalitäten bieten aber auch gleichzeitig wo Unterschiede liegen. Folgendes Codestück legt ein Zoom Icon über ein Bild rein unter zuhilfe von CSS. Hierbei wird ein leeres span-Tag eingefügt auf das wir später unser Icon legen wollen. ?View Code HTML1 2 3 4 [...]]]></description> <content:encoded><![CDATA[<p>An einem kleinen Beispiel soll gezeigt werden inwiefern CSS und ein JS-Framework gleiche Funktionalitäten bieten aber auch gleichzeitig wo Unterschiede liegen.<br
/> Folgendes Codestück legt ein Zoom Icon über ein Bild rein unter zuhilfe von CSS. Hierbei wird ein leeres span-Tag eingefügt auf das wir später unser Icon legen wollen.</p><div
class="wp_codebox_msgheader"><span
class="right"><sup><a
href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span
style="color: #99cc00">?</span></a></sup></span><span
class="left"><a
href="javascript:;" onclick="javascript:showCodeTxt('p347code17'); return false;">View Code</a> HTML</span><div
class="codebox_clear"></div></div><div
class="wp_codebox"><table><tr
id="p34717"><td
class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
</pre></td><td
class="code" id="p347code17"><pre class="html" style="font-family:monospace;">&lt;div id=&quot;picGallery&quot;&gt;
    &lt;h2&gt;CSS-Code&lt;/h2&gt;
    &lt;a href=&quot;someBigPic.jpg&quot;&gt;
        &lt;span&gt;&lt;/span&gt;
        &lt;img src=&quot;someSmallerPic.jpg&quot; alt=&quot;&quot; /&gt;
    &lt;/a&gt;
    &lt;a href=&quot;anotherBigPic.jpg&quot;&gt;
        &lt;span&gt;&lt;/span&gt;
        &lt;img src=&quot;AnotherSmallPic.jpg&quot; alt=&quot;&quot; /&gt;
    &lt;/a&gt;
&lt;/div&gt;</pre></td></tr></table></div><p>Das CSS sähe dabei so aus:</p><div
class="wp_codebox_msgheader"><span
class="right"><sup><a
href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span
style="color: #99cc00">?</span></a></sup></span><span
class="left"><a
href="javascript:;" onclick="javascript:showCodeTxt('p347code18'); return false;">View Code</a> CSS</span><div
class="codebox_clear"></div></div><div
class="wp_codebox"><table><tr
id="p34718"><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
</pre></td><td
class="code" id="p347code18"><pre class="css" style="font-family:monospace;"><span style="color: #cc00cc;">#picGallery</span><span style="color: #00AA00;">&#123;</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;">overflow</span><span style="color: #00AA00;">:</span>  <span style="color: #993333;">hidden</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span>
<span style="color: #cc00cc;">#picGallery</span> a <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;">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;">margin</span><span style="color: #00AA00;">:</span>     <span style="color: #933;">5px</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span>
<span style="color: #cc00cc;">#picGallery</span> a span <span style="color: #00AA00;">&#123;</span>
   <span style="color: #000000; font-weight: bold;">display</span><span style="color: #00AA00;">:</span><span style="color: #993333;">none</span><span style="color: #00AA00;">;</span>
   <span style="color: #000000; font-weight: bold;">background-image</span><span style="color: #00AA00;">:</span><span style="color: #993333;">url</span><span style="color: #00AA00;">&#40;</span><span style="color: #ff0000; font-style: italic;">zoom.png</span><span style="color: #00AA00;">&#41;</span><span style="color: #00AA00;">;</span>
   <span style="color: #000000; font-weight: bold;">background-repeat</span><span style="color: #00AA00;">:</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;">48px</span><span style="color: #00AA00;">;</span>
   <span style="color: #000000; font-weight: bold;">height</span><span style="color: #00AA00;">:</span><span style="color: #933;">48px</span><span style="color: #00AA00;">;</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;">left</span><span style="color: #00AA00;">:</span><span style="color: #933;">15px</span><span style="color: #00AA00;">;</span>
   <span style="color: #000000; font-weight: bold;">top</span><span style="color: #00AA00;">:</span><span style="color: #933;">15px</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span>
<span style="color: #cc00cc;">#picGallery</span> img <span style="color: #00AA00;">&#123;</span>
   <span style="color: #000000; font-weight: bold;">border</span><span style="color: #00AA00;">:</span>    <span style="color: #993333;">solid</span> <span style="color: #933;">1px</span> <span style="color: #cc00cc;">#999</span><span style="color: #00AA00;">;</span>
   <span style="color: #000000; font-weight: bold;">padding</span><span style="color: #00AA00;">:</span>  <span style="color: #933;">5px</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span>
<span style="color: #cc00cc;">#picGallery</span>  a<span style="color: #3333ff;">:hover </span>span <span style="color: #00AA00;">&#123;</span>
   <span style="color: #000000; font-weight: bold;">display</span><span style="color: #00AA00;">:</span>   <span style="color: #993333;">block</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span></pre></td></tr></table></div><p>Soweit sogut. Nun mit Hilfe von jQuery. Der HTML Teil ist fast identsich. Allerdings brauchen wir hier die span-Tags noch nicht.</p><div
class="wp_codebox_msgheader"><span
class="right"><sup><a
href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span
style="color: #99cc00">?</span></a></sup></span><span
class="left"><a
href="javascript:;" onclick="javascript:showCodeTxt('p347code19'); return false;">View Code</a> HTML</span><div
class="codebox_clear"></div></div><div
class="wp_codebox"><table><tr
id="p34719"><td
class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
</pre></td><td
class="code" id="p347code19"><pre class="html" style="font-family:monospace;">&lt;div id=&quot;picGallery&quot;&gt;
    &lt;h1&gt;jQuery Code&lt;/h1&gt;
    &lt;a href=&quot;someBigPic.jpg&quot;&gt;
        &lt;img src=&quot;someSmallerPic.jpg&quot; alt=&quot;&quot; /&gt;
    &lt;/a&gt;
    &lt;a href=&quot;anotherBigPic.jpg&quot;&gt;
        &lt;img src=&quot;AnotherSmallPic.jpg&quot; alt=&quot;&quot; /&gt;
    &lt;/a&gt;
&lt;/div&gt;</pre></td></tr></table></div><p>Der JS-Code erzeugt den span und kümmert sich um das Einblenden..</p><div
class="wp_codebox_msgheader"><span
class="right"><sup><a
href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span
style="color: #99cc00">?</span></a></sup></span><span
class="left"><a
href="javascript:;" onclick="javascript:showCodeTxt('p347code20'); return false;">View Code</a> JAVASCRIPT</span><div
class="codebox_clear"></div></div><div
class="wp_codebox"><table><tr
id="p34720"><td
class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
</pre></td><td
class="code" id="p347code20"><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;">//Füge jedem a-tag in dem div mit der id &quot;picGallery&quot; ein span-Tag hinzu</span>
      $<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;#picGallery a&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">append</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;&lt;span&gt;&lt;/span&gt;&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
      <span style="color: #006600; font-style: italic;">//Standard fading Funktionen von jQuery</span>
      $<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;#gallery2 a&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">hover</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: #000066; font-weight: bold;">this</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">children</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;span&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">fadeIn</span><span style="color: #009900;">&#40;</span><span style="color: #CC0000;">600</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
      <span style="color: #009900;">&#125;</span><span style="color: #339933;">,</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: #000066; font-weight: bold;">this</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">children</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;span&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">fadeOut</span><span style="color: #009900;">&#40;</span><span style="color: #CC0000;">200</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>
<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div><p>Das wars auch schon. Natürlich muss das CSS im HTML Dokument referenziert werden, allerdings kann dann die a:hover Eigenschaft weggelassen werden. Bei Click würde das Bild in einem neuen Fenster geöffnet, bei Bedarf ließe sich noch ein Bildergalerie Skript damit verbinden. Ich hoffe das bei Gelegenheit noch vorstellen zu können.<br
/> Viel Erfolg!!</p><h3  class="related_post_title">Ähnliche Artikel</h3><ul
class="related_post"><li>1. Dezember 2010 -- <a
href="http://www.mysrc.de/html5/jquery-mobile-der-eitenaufbau/" title="jQuery Mobile &#8211; Der Seitenaufbau">jQuery Mobile &#8211; Der Seitenaufbau</a></li><li>25. November 2010 -- <a
href="http://www.mysrc.de/jquery/jquery-mobile-web-apps-mit-jquery/" title="jQuery Mobile &#8211; Web-Apps mit jQuery">jQuery Mobile &#8211; Web-Apps mit jQuery</a></li><li>19. November 2010 -- <a
href="http://www.mysrc.de/jquery/praxistipp-suchfeld-leeren-on-focus-jquery/" title="Praxistipp: Suchfeld leeren on focus (jQuery)">Praxistipp: Suchfeld leeren on focus (jQuery)</a></li></ul>]]></content:encoded> <wfw:commentRss>http://www.mysrc.de/jquery/jquery-versus-css/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> </channel> </rss>
