<?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>monkey-business.biz &#187; Javascript</title> <atom:link href="http://www.monkey-business.biz/tag/javascript/feed/" rel="self" type="application/rss+xml" /><link>http://www.monkey-business.biz</link> <description>Belästigung der Allgemeinheit - der private Weblog</description> <lastBuildDate>Tue, 24 Jan 2012 14:53:33 +0000</lastBuildDate> <language>en</language> <sy:updatePeriod>daily</sy:updatePeriod> <sy:updateFrequency>4</sy:updateFrequency> <item><title>Google Maps Routen mit jQuery in Shadowbox anzeigen</title><link>http://www.monkey-business.biz/1896/google-maps-routen-mit-jquery-in-shadowbox-anzeigen/</link> <comments>http://www.monkey-business.biz/1896/google-maps-routen-mit-jquery-in-shadowbox-anzeigen/#comments</comments> <pubDate>Sun, 15 Jan 2012 22:18:53 +0000</pubDate> <dc:creator>Loaden</dc:creator> <category><![CDATA[Belästigung der Allgemeinheit - mein privater Weblog]]></category> <category><![CDATA[Google Maps]]></category> <category><![CDATA[Highlighting]]></category> <category><![CDATA[Javascript]]></category> <category><![CDATA[jQuery]]></category> <category><![CDATA[Shadowbox.js]]></category> <category><![CDATA[target="_blank"]]></category> <category><![CDATA[Tutorial]]></category> <category><![CDATA[Webdesign]]></category><guid isPermaLink="false">http://www.monkey-business.biz/?p=1896</guid> <description><![CDATA[Dem Besucher die Möglichkeit zu geben die Anfahrt zu einem Unternehmensstandort berechnen zu lassen ist heut zu tage ein muss für jede Unternehmens Webseite. Unschön ist ein weiteres Fenster / Pop-Up das sich öffnet nur um eine Anfahrtsskizze über die Google Maps Funktion anzuzeigen. Im selben Fenster wollen wir Google Maps nicht öffnen. Wir wollen [...]]]></description> <content:encoded><![CDATA[<p>Dem Besucher die Möglichkeit zu geben die Anfahrt zu einem Unternehmensstandort berechnen zu lassen ist heut zu tage ein muss für jede Unternehmens Webseite. Unschön ist ein weiteres Fenster / Pop-Up das sich öffnet nur um eine Anfahrtsskizze über die Google Maps Funktion anzuzeigen. Im selben Fenster wollen wir Google Maps nicht öffnen. Wir wollen den Besucher nicht von der Webseite weg manövrieren.</p><p>Ein Lösungsvorschlag von mir ist das öffnen von Google Maps in einer Highlighting-Box wie der Shadowbox. Als angenehm empfunden haben viele Besucher einen zweiten Link für die Google Routen Berechnung. Bei den Vorhaben seine Anfahrtsroute zu berechnen sollte man dem Besucher nicht im Interface / Platz beschneiden.</p><p>Hierzu habe ich mithilfe von jQuery ein kleines Script geschrieben, das am besten in den Header des Dokumentes, nach dem jQuery Framework und der Shadowbox, eingebunden wird. Ein paar HTML Elemente müssen wir ebenfalls auf der Webseite platzieren um dem Besucher Interaktion zu ermöglichen.</p><p>Das Beispiel auf dieser Seite beeinhaltet die Anzeige der Anfahrt, dargestellt in der Shadowbox, ins Watergate nach Berlin.</p> <input type="text" name="saddr" title="Ihre Adresse" class="input-text" id="google-route-f"> <a href="http://maps.google.de?daddr=Falckensteinstr. 49, 10997 Berlin&amp;&#038;output=embed&#038;iframe=1saddr=" title="Anfahrt anzeigen" id="google-route-b" target="_blank">Anfahrt anzeigen</a>&nbsp;&bull;&nbsp;<a href="http://maps.google.de?daddr=Falckensteinstr. 49, 10997 Berlin&amp;saddr=" title="Route berechnen" id="google-route-d" target="_blank">Route berechnen</a></p><link rel="stylesheet" type="text/css" href="http://www.monkey-business.biz/wp-content/uploads/2011/07/shadowbox/shadowbox.css" /><script type="text/javascript" src="http://www.monkey-business.biz/wp-content/uploads/2011/07/shadowbox/shadowbox.js"></script><script type="text/javascript">
jQuery(document).ready(function() {
Shadowbox.init({
    handleOversize: 'drag',
    modal: true
});
jQuery('#google-route-b').bind('click', function() {
    Shadowbox.open({
	   content: jQuery(this).attr('href')+jQuery('#google-route-f').attr('value'),
  	   player:  'iframe'
   });
   return false;
});
jQuery('#google-route-d').bind('click', function() {
	jQuery(this).attr('href', jQuery(this).attr('href')+jQuery('#google-route-f').attr('value'));
	return true;
});
});
</script><br /> <strong>Fremd Beispiel 2:</strong> &#8220;<a href="http://www.loaden-development.com/psd-zu-wordpress-theme/#kontakt" target="_blank" title="PSD zu WordPress Theme">PSD zu WordPress Theme</a>&#8221; <small>(unten auf der Seite)</small></p><p>Die Einrichtung um Google Maps in der Shadowbox öffnen zu lassen gestaltet sich, wenn man weiß wie, sehr einfach.<br /> Das jQuery Framework und die Shadowbox müssen vor Script Aufruf in das HTML Dokument eingebunden werden. Dies geschieht im Kopfbereich folgerndermaßen:</p><div class="wp_syntax"><div class="code"><pre class="html4strict" style="font-family:monospace;"><span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">link</span> <span style="color: #000066;">rel</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;stylesheet&quot;</span> <span style="color: #000066;">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;shadowbox.css&quot;</span> <span style="color: #66cc66;">/</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">script</span> <span style="color: #000066;">src</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;jquery.js&quot;</span> <span style="color: #000066;">type</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;text/javascript&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;">src</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;shadowbox.js&quot;</span> <span style="color: #000066;">type</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;text/javascript&quot;</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">script</span>&gt;</span></pre></div></div><p>Aktuelle Downloads findest du hier:</p><ul><li><a href="http://jquery.com/" title="jQuery Framework" target="_blank">jQuery Framework</a></li><li><a href="http://www.shadowbox-js.com/download.html" title="Shadowbox" target="_blank">Shadowbox</a></li></ul><p>Dieses Script bindet das &#8220;click&#8221; Event an den Link und macht es uns möglich nach einem Klick eines Benutzers mit einer eigenen Funktion zu reagieren. In unserer Funktion werden wird der Wert des Formularfeldes ermittelt und als GET Parameter (Adresse) für den iFrame der Shadowbox verwendet.</p><p>Das zweite &#8220;click&#8221; Event öffnet ein neues Fenster / Tab mit der Adresse aus dem Formularfeld für die Google Routen Berechnung.</p><div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;">jQuery<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>
   Shadowbox.<span style="color: #660066;">init</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#123;</span>
       handleOversize<span style="color: #339933;">:</span> <span style="color: #3366CC;">'drag'</span><span style="color: #339933;">,</span>
       modal<span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">true</span>
   <span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
   jQuery<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'#google-route-b'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">bind</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'click'</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>
       Shadowbox.<span style="color: #000066;">open</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#123;</span>
	   content<span style="color: #339933;">:</span> jQuery<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;">attr</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'href'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">+</span>jQuery<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'#google-route-f'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">attr</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'value'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>
  	   player<span style="color: #339933;">:</span>  <span style="color: #3366CC;">'iframe'</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: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
   jQuery<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'#google-route-d'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">bind</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'click'</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>
	jQuery<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;">attr</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'href'</span><span style="color: #339933;">,</span> jQuery<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;">attr</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'href'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">+</span>jQuery<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'#google-route-f'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">attr</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'value'</span><span style="color: #009900;">&#41;</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;">true</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></div></div><p>Der Selektor #google-route-b steht hierbei für den Link auf den geklickt werden muss um unser &#8220;Formular&#8221; abzusenden. #google-route-f bezeichnet das Feld mit der Adresse des Besuchers. Die Rückgabe von &#8220;false&#8221; am Ende der Funktion verhindert das öffnen von den Google Routen im selben Fenster.</p><p>#google-route-d kennzeichnet den Link um die Google Routen Berechnung. Nach dem Einfügen der Adresse aus dem Input Feld in den Link wird &#8220;true&#8221; zurück gegeben um dem Browser zu signalisieren weiter mit seiner standard Link Routine zu arbeiten.</p><div class="wp_syntax"><div class="code"><pre class="html4strict" style="font-family:monospace;"><span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">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;saddr&quot;</span> <span style="color: #000066;">title</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;Ihre Adresse&quot;</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;input-text&quot;</span> <span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;google-route-f&quot;</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">a</span> <span style="color: #000066;">href</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;http://maps.google.de?daddr=***DEINE STRAßE, DEINE STADT***&amp;amp;&amp;output=embed&amp;saddr=&quot;</span> <span style="color: #000066;">title</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;Anfahrt anzeigen&quot;</span> <span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;google-route-b&quot;</span> <span style="color: #000066;">target</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;_blank&quot;</span>&gt;</span>Anfahrt anzeigen<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">a</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">a</span> <span style="color: #000066;">href</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;http://maps.google.de?daddr=***DEINE STRAßE, DEINE STADT***&amp;amp;saddr=&quot;</span> <span style="color: #000066;">title</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;Route berechnen&quot;</span> <span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;google-route-d&quot;</span> <span style="color: #000066;">target</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;_blank&quot;</span>&gt;</span>Route berechnen<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">a</span>&gt;</span></pre></div></div><p>***DEINE STRAßE, DEINE STADT*** ist natürlich durch die jeweilige Firmenadresse zu ersetzen.</p> ]]></content:encoded> <wfw:commentRss>http://www.monkey-business.biz/1896/google-maps-routen-mit-jquery-in-shadowbox-anzeigen/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>jQuery: Externe Links in neuem Fenster / Tab öffnen</title><link>http://www.monkey-business.biz/2503/jquery-externe-links-in-neuem-fenster-tab-offnen/</link> <comments>http://www.monkey-business.biz/2503/jquery-externe-links-in-neuem-fenster-tab-offnen/#comments</comments> <pubDate>Wed, 16 Nov 2011 10:11:22 +0000</pubDate> <dc:creator>Loaden</dc:creator> <category><![CDATA[Belästigung der Allgemeinheit - mein privater Weblog]]></category> <category><![CDATA[Javascript]]></category> <category><![CDATA[jQuery]]></category> <category><![CDATA[target="_blank"]]></category> <category><![CDATA[Usability]]></category> <category><![CDATA[Webdesign]]></category><guid isPermaLink="false">http://www.monkey-business.biz/?p=2503</guid> <description><![CDATA[Ob es ratsam ist externe Links in neuem Fenster / Tab zu öffnen bzw. Verweise generell in neuen Tabs / Fenstern zu öffnen ist umstritten. Grundsätzlich werden dabei zwei sinnvolle Ansätze vertreten. Ansatz A Dem Benutzer ist es selbst überlassen wie sich Links nach anklicken verhalten. Alle Links öffnen sich im selben Fenster. Ansatz B [...]]]></description> <content:encoded><![CDATA[<p>Ob es ratsam ist externe Links in neuem Fenster / Tab zu öffnen bzw. Verweise generell in neuen Tabs / Fenstern zu öffnen ist umstritten. Grundsätzlich werden dabei zwei sinnvolle Ansätze vertreten.</p><ul><li>Ansatz A<p>Dem Benutzer ist es selbst überlassen wie sich Links nach anklicken verhalten. Alle Links öffnen sich im selben Fenster.</p></li><li>Ansatz B<p>Dem Benutzer wird die Entscheidung abgenommen und externe Links öffnen sich in einem neuen Fenster / Tab. Hierbei wird die eigentliche Seite nicht verlassen.</p></li></ul><p>Ich selbst tendiere zu Ansatz B. Sollte es, aus welchen Gründen auch immer, nicht möglich sein ein target=&#8221;_blank&#8221; Server seitig in das HTML Dokument einzufügen verwende ich eine Javascript Funktion auf jQuery Basis.</p><h2 style="font-size: 12px;">Externe Links in neuem Fenster öffnen -<span style="font-size: 22px;">extendable</span></h2><p>Diese Methode ist insbesondere interessant wenn verschiedene Faktoren für die Prüfung eines Links erforderlich sind.</p><div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #006600; font-style: italic;">/* Nicht vergessen das jQuery Framework vor diesem Snippet einzubinden  */</span>
jQuery<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: #003366; font-weight: bold;">var</span> getdomainname <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>url<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		<span style="color: #000066; font-weight: bold;">return</span> url.<span style="color: #660066;">split</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'/'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#91;</span><span style="color: #CC0000;">2</span><span style="color: #009900;">&#93;</span>.<span style="color: #660066;">split</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">':'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#91;</span><span style="color: #CC0000;">0</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
	<span style="color: #003366; font-weight: bold;">var</span> targetblank <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: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>window.<span style="color: #660066;">location</span>.<span style="color: #660066;">host</span> <span style="color: #339933;">!=</span> getdomainname<span style="color: #009900;">&#40;</span>jQuery<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;">attr</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'href'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>
			jQuery<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;">attr</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'target'</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">'_blank'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
	jQuery<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'body a'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">each</span><span style="color: #009900;">&#40;</span>targetblank<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></div></div><p>Mithilfe dieser Funktion können jederzeit auch einzelne Bereiche der Internetseite angesprochen werden. Strukturen ohne externe Links sollten auch aus Performance Gründen nicht von der Funktion überprüft werden.</p><p>Weitere Informationen zur Funktion getdomainname() findest du in meinem vorherigen Post: <a href="http://www.monkey-business.biz/2499/javascript-domain-name-ermitteln-js-get-domain-name-via-url/" title="Javascript: Domain Name ermitteln (JS: get domain name) via URL">Javascript: Domain Name ermitteln (JS: get domain name) via URL</a></p><h2 style="font-size: 12px;">Externe Links in neuem Fenster öffnen &#8211; <span style="font-size: 22px;">quicky</span></h2><div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #006600; font-style: italic;">/* Nicht vergessen das jQuery Framework vor diesem Snippet einzubinden  */</span>
jQuery<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>
        jQuery<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;a[href^='http']:not([href^='&quot;</span><span style="color: #339933;">+</span>window.<span style="color: #660066;">location</span>.<span style="color: #660066;">host</span><span style="color: #339933;">+</span><span style="color: #3366CC;">&quot;'])&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">attr</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'target'</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">'_blank'</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></div></div><p>Diese Methode fügt allen a Tags mit einem http:// am Anfang des href Attributes das nicht der aktuellen Domain entspricht das target=&#8221;_blank&#8221; hinzu. Nicht zu vergessen ist, das auch hier mit Hilfe des Selektors aus einzelne Bereiche des HTML Dokuments angesprochen werden können. Dieser Vorgehensweise fehlt es leider an Erweiterbarkeit. Insbesondere für Filter Regeln zur die Auswahl der Links.</p> ]]></content:encoded> <wfw:commentRss>http://www.monkey-business.biz/2503/jquery-externe-links-in-neuem-fenster-tab-offnen/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>Javascript: Domain Name ermitteln (JS: get domain name) via URL</title><link>http://www.monkey-business.biz/2499/javascript-domain-name-ermitteln-js-get-domain-name-via-url/</link> <comments>http://www.monkey-business.biz/2499/javascript-domain-name-ermitteln-js-get-domain-name-via-url/#comments</comments> <pubDate>Mon, 14 Nov 2011 06:26:38 +0000</pubDate> <dc:creator>Loaden</dc:creator> <category><![CDATA[Belästigung der Allgemeinheit - mein privater Weblog]]></category> <category><![CDATA[Domain]]></category> <category><![CDATA[Javascript]]></category> <category><![CDATA[URL]]></category><guid isPermaLink="false">http://www.monkey-business.biz/?p=2499</guid> <description><![CDATA[Die aktuelle Domain in Form *Subdomain**Domain Name**Top-Level Domain* einer Internetseite wird in Javascript mit window.location.host ermittelt. Hierbei werden ebenfalls Subdomains beachtet. Die Top-Level Domain erhält man mit: document.domain Domain Name aus einer URL ermitteln Um in Javascript den Domain Name aus einer URL zu ermitteln benötigt es keinen großen Aufwand. Für das Ermitteln des Domain [...]]]></description> <content:encoded><![CDATA[<p>Die aktuelle Domain in Form *Subdomain**Domain Name**Top-Level Domain* einer Internetseite wird in Javascript mit</p><div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;">window.<span style="color: #660066;">location</span>.<span style="color: #660066;">host</span></pre></div></div><p>ermittelt. Hierbei werden ebenfalls Subdomains beachtet. Die Top-Level Domain erhält man mit:</p><div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;">document.<span style="color: #660066;">domain</span></pre></div></div><h2>Domain Name aus einer URL ermitteln</h2><p>Um in Javascript den Domain Name aus einer URL zu ermitteln benötigt es keinen großen Aufwand. Für das Ermitteln des Domain Namens aus einer URL in Javascript verwende folgende Funktion:</p><div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #003366; font-weight: bold;">var</span> getdomainname <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>url<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
	<span style="color: #000066; font-weight: bold;">return</span> url.<span style="color: #660066;">split</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'/'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#91;</span><span style="color: #CC0000;">2</span><span style="color: #009900;">&#93;</span>.<span style="color: #660066;">split</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">':'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#91;</span><span style="color: #CC0000;">0</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></div></div><p>In diesem Einzeiler wird der URL String zweifach geteilt. Anhand von /, : und jeweils mit den passenden teilen des Arrays weitergearbeitet. Diese Array Einzelteile werden durch [2] und [0] definiert. Reinen PHP Programmierern wird diese Vorgehensweise suspekt sein. Eine alternative Lösungsmöglichkeit stellt das ermitteln der Domain mittels einem Regulären Ausdruck dar.</p><div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;">getdomainname<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'http://www.example.com/example/example'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div><p>Der Rückgabewert hierbei ist &#8220;www.example.com&#8221;.</p> ]]></content:encoded> <wfw:commentRss>http://www.monkey-business.biz/2499/javascript-domain-name-ermitteln-js-get-domain-name-via-url/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>Shadowbox Textarea / Input &#8211; left, right, whitespace Bugfix</title><link>http://www.monkey-business.biz/2486/shadowbox-textarea-input-left-right-whitespace-bugfix/</link> <comments>http://www.monkey-business.biz/2486/shadowbox-textarea-input-left-right-whitespace-bugfix/#comments</comments> <pubDate>Sat, 12 Nov 2011 19:19:52 +0000</pubDate> <dc:creator>Loaden</dc:creator> <category><![CDATA[Belästigung der Allgemeinheit - mein privater Weblog]]></category> <category><![CDATA[Bugfix]]></category> <category><![CDATA[Highlighting]]></category> <category><![CDATA[Javascript]]></category> <category><![CDATA[Shadowbox.js]]></category><guid isPermaLink="false">http://www.monkey-business.biz/?p=2486</guid> <description><![CDATA[Mit der Shadowbox treten Probleme beim verwenden in Eingabefeldern (input Tags) und Textfelder (textarea Tags) auf. Die Leertaste sowie die links und rechts Tasten werden beim tippen in Textfelder nicht eingefügt bzw. das Textfeld reagiert nicht. Die Ursache ist das Shadowbox.js, unsere Highlight-Box, die Tastensignale als Steuersignale für das Weiterschalten und der gleichen verwendet. Abhilfe [...]]]></description> <content:encoded><![CDATA[<p>Mit der <a href="http://www.shadowbox-js.com/" title="Shadowbox Webseite" target="_blank">Shadowbox</a> treten Probleme beim verwenden in Eingabefeldern (input Tags) und Textfelder (textarea Tags) auf. Die Leertaste sowie die links und rechts Tasten werden beim tippen in Textfelder nicht eingefügt bzw. das Textfeld reagiert nicht.</p><p>Die Ursache ist das Shadowbox.js, unsere Highlight-Box, die Tastensignale als Steuersignale für das Weiterschalten und der gleichen verwendet. Abhilfe schafft das Initialisieren der Shadowbox mit dem Parameter <strong>enableKeys: false</strong>. Beispiel Code:</p><div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;">Shadowbox.<span style="color: #660066;">init</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#123;</span>
     handleOversize<span style="color: #339933;">:</span> <span style="color: #3366CC;">'drag'</span><span style="color: #339933;">,</span>
     modal<span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">true</span><span style="color: #339933;">,</span>
     enableKeys<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></pre></div></div>]]></content:encoded> <wfw:commentRss>http://www.monkey-business.biz/2486/shadowbox-textarea-input-left-right-whitespace-bugfix/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>Asynchrone Integration von Google+, twitter tweet &amp; facebook Like Button</title><link>http://www.monkey-business.biz/2222/asynchrone-integration-von-google-twitter-tweet-facebook-like-button/</link> <comments>http://www.monkey-business.biz/2222/asynchrone-integration-von-google-twitter-tweet-facebook-like-button/#comments</comments> <pubDate>Thu, 18 Aug 2011 11:37:22 +0000</pubDate> <dc:creator>Loaden</dc:creator> <category><![CDATA[Belästigung der Allgemeinheit - mein privater Weblog]]></category> <category><![CDATA[Facebook]]></category> <category><![CDATA[Google]]></category> <category><![CDATA[Javascript]]></category> <category><![CDATA[Social Media]]></category> <category><![CDATA[twitter]]></category> <category><![CDATA[Webdesign]]></category> <category><![CDATA[WordPress]]></category><guid isPermaLink="false">http://www.monkey-business.biz/?p=2222</guid> <description><![CDATA[Die Verbreitung der eignen Blog-Inhalte über Soziale Netzwerke gehört inzwischen zum Pflichtprogramm für jeden Blogger und ist auch für Firmenpräsentationen oder Online Shops ein wichtiges Werbemittel geworden. Social Bookmark Dienste kristallisieren sich inzwischen als Hype heraus. Google Bookmarks, Digg oder Mr. Wong haben weniger Verbreitung oder sind Nutzern gänzlich unbekannt. Draus resultiert, das diese Dienste [...]]]></description> <content:encoded><![CDATA[<p>Die Verbreitung der eignen Blog-Inhalte über Soziale Netzwerke gehört inzwischen zum Pflichtprogramm für jeden Blogger und ist auch für Firmenpräsentationen oder Online Shops ein wichtiges Werbemittel geworden.</p><p>Social Bookmark Dienste kristallisieren sich inzwischen als Hype heraus. <a href="http://www.google.com/bookmarks" target="_blank" rel="nofollow" title="Google Bookmarks">Google Bookmarks</a>, <a href="http://digg.com" target="_blank" rel="nofollow" title="Digg">Digg</a> oder <a href="http://www.mister-wong.com/" target="_blank" rel="nofollow" title="Mr. Wong">Mr. Wong</a> haben weniger Verbreitung oder sind Nutzern gänzlich unbekannt. Draus resultiert, das diese Dienste nicht den gewünschten Besucherstrom bringen.</p><p><a href="http://plus.google.com/" target="_blank" rel="nofollow" title="plus.google.com">Google+</a>, <a href="http://twitter.com/" target="_blank" rel="nofollow" title="twitter.com">twitter</a> und <a href="http.//facebook.com/" target="_blank" rel="nofollow" title="facebook.com">facebook</a>. Die 3 Großen im Netz, die jedem bekannt sind, auf diese möchte ich meinen Focus in diesem Blog Eintrag legen.</p><p>Für die Integration dieser Buttons stellen die 3 Communities jeweils Button Generatoren und gut verständliche Anleitungen zur Integration bereit.</p><ul><li><a href="http://www.google.com/intl/de/webmasters/+1/button/" target="_blank" rel="nofollow" title="Google+ Button Integration">Google+ Button Integration</a></li><li><a href="http://twitter.com/about/resources/tweetbutton" target="_blank" rel="nofollow" title="twitter tweet Button Integratio">twitter tweet Button Integration</a></li><li><a href="http://developers.facebook.com/docs/reference/plugins/like/" target="_blank" rel="nofollow" title="facebook Like Button Integratio">facebook Like Button Integration</a></li></ul><p>Jeder dieser Buttons läd ein Script vom Server des jeweiligen Anbieters um die Buttons mit Funktionalität auszustatten. Das laden der Scripte kann, je nach Last der Ressourcen der Drittanbieter (Google, twitter, facebook), den Aufbau der Seite bremsen.</p><p>Google stellt zur Integration seines Buttons von Haus aus die Möglichkeit für eine asynchrone Integration bereit. Auf Basis dieses kleinen Javascriptes ist es ein leichtes den twitter tweet und den facebook Like Button ebenfalls asynchron in unsere Webseite zu integrieren.</p><p>Folgendes Script läd Google+, twitter tweet &#038; facebook Like Button asynchron von den Drittanbieter Servern:</p><div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;">window.___gcfg <span style="color: #339933;">=</span> <span style="color: #009900;">&#123;</span>lang<span style="color: #339933;">:</span> <span style="color: #3366CC;">'de'</span><span style="color: #009900;">&#125;</span><span style="color: #339933;">;</span> <span style="color: #006600; font-style: italic;">// google+</span>
<span style="color: #003366; font-weight: bold;">var</span> socials <span style="color: #339933;">=</span> <span style="color: #009900;">&#91;</span><span style="color: #3366CC;">'https://apis.google.com/js/plusone.js'</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">'http://platform.twitter.com/widgets.js'</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">'http://connect.facebook.net/de_DE/all.js#xfbml=1'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>	
<span style="color: #000066; font-weight: bold;">for</span> <span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">var</span> i <span style="color: #339933;">=</span> <span style="color: #CC0000;">0</span><span style="color: #339933;">;</span> i <span style="color: #339933;">&lt;</span> socials.<span style="color: #660066;">length</span><span style="color: #339933;">;</span> i<span style="color: #339933;">++</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
  	<span style="color: #003366; font-weight: bold;">var</span> po <span style="color: #339933;">=</span> document.<span style="color: #660066;">createElement</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'script'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  	po.<span style="color: #660066;">type</span> <span style="color: #339933;">=</span> <span style="color: #3366CC;">'text/javascript'</span><span style="color: #339933;">;</span>
  	po.<span style="color: #660066;">async</span> <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">true</span><span style="color: #339933;">;</span>
	po.<span style="color: #660066;">src</span> <span style="color: #339933;">=</span> socials<span style="color: #009900;">&#91;</span>i<span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
	<span style="color: #003366; font-weight: bold;">var</span> s <span style="color: #339933;">=</span> document.<span style="color: #660066;">getElementsByTagName</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'script'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#91;</span><span style="color: #CC0000;">0</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
	s.<span style="color: #660066;">parentNode</span>.<span style="color: #660066;">insertBefore</span><span style="color: #009900;">&#40;</span>po<span style="color: #339933;">,</span> s<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></div></div><p>Die Einbindung des Scriptes sollte im Kopfbereich (head-Tag) unseres Dokumentes erfolgen.</p><p>Ein Beispiel für die jeweiligen HTML Tags stellt dieser Code Block hier da, welcher in den Inhalts Bereich (body-Tag) des Dokumentes eingebunden werden kann:</p><div class="wp_syntax"><div class="code"><pre class="html4strict" style="font-family:monospace;"><span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">div</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;g-plusone&quot;</span> data-<span style="color: #000066;">size</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;medium&quot;</span> <span style="color: #000066;">href</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;***LINK***&quot;</span>&gt;&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: #000000; font-weight: bold;">a</span> <span style="color: #000066;">href</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;http://twitter.com/share&quot;</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;twitter-share-button&quot;</span> data-url<span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;***LINK***&quot;</span> data-count<span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;horizontal&quot;</span> <span style="color: #000066;">lang</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;de&quot;</span>&gt;</span>Tweet<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;">div</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;fb-like&quot;</span> <span style="color: #000066;">href</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;***LINK***&quot;</span> <span style="color: #000066;">width</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;450&quot;</span> show_faces<span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;false&quot;</span> <span style="color: #000066;">action</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;like&quot;</span> font<span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;verdana&quot;</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">div</span>&gt;</span></pre></div></div><p>Der Platzhalter ***LINK*** ist hierbei durch den Verweis zu ersetzen, der an Google, twitter oder facebook weitergereicht werden soll. Anpassungen der Buttons in Aussehen, Sprache oder Funktionalität können von den jeweiligen Anbietern ersehen werden. Siehe Generatoren und Anleitungen der jeweiligen Anbieter. (siehe oben im Artikel)</p><h2>Google+, twitter tweet &#038; facebook Like für WordPress</h2><p>In diesem WordPress Blog-System ist Google+, twitter tweet &#038; facebook Like auf die bereits aufgezeigte Weise implementiert. Um den Short-Link des jeweiligen Artikels in einem WordPress Template zu ermitteln verwende ich die Funktion <a href="http://codex.wordpress.org/Function_Reference/wp_get_shortlink" target="_blank" rel="nofollow" title="wp_get_shortlink() Funktionsreferenz auf codex.wordpress.org">wp_get_shortlink()</a>. Der Rückgabe Wert dieser Funktion oder die Funktion selber muss lediglich durch den ***LINK*** Platzhalter ersetzt werden.</p> ]]></content:encoded> <wfw:commentRss>http://www.monkey-business.biz/2222/asynchrone-integration-von-google-twitter-tweet-facebook-like-button/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>Javascript: prüfen ob ein Element existiert</title><link>http://www.monkey-business.biz/672/javascript-prufen-ob-ein-element-existiert/</link> <comments>http://www.monkey-business.biz/672/javascript-prufen-ob-ein-element-existiert/#comments</comments> <pubDate>Thu, 25 Feb 2010 15:48:09 +0000</pubDate> <dc:creator>Loaden</dc:creator> <category><![CDATA[Belästigung der Allgemeinheit - mein privater Weblog]]></category> <category><![CDATA[Entwicklung]]></category> <category><![CDATA[Javascript]]></category><guid isPermaLink="false">http://www.monkey-business.biz/?p=672</guid> <description><![CDATA[Da die Statistik sehr viele Suchanfragen nach dem oben betitelten Thema verzeichnet, habe ich mich entschlossen darüber zu schreiben. Allgemein ist &#8220;Javascript: prüfen ob ein Element existiert&#8221; ein gutes Google Thema. In Javascript ist das prüfen ob ein Element existiert bzw. vorhanden ist ebenso einfach wie in jQuery. Zum Javascriptcode: if &#40;document.getElementById&#40;'divname'&#41;&#41; &#123; // Code [...]]]></description> <content:encoded><![CDATA[<p>Da die Statistik sehr viele Suchanfragen nach dem oben betitelten Thema verzeichnet, habe ich mich entschlossen darüber zu schreiben. Allgemein ist &#8220;Javascript: prüfen ob ein Element existiert&#8221; ein gutes Google Thema. In Javascript ist das prüfen ob ein Element existiert bzw. vorhanden ist ebenso einfach wie in <a href="/119/jquery-prufen-ob-ein-element-existiert/" title="jQuery: prüfen ob ein Element existiert">jQuery</a>. Zum Javascriptcode:</p><div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>document.<span style="color: #660066;">getElementById</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'divname'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
<span style="color: #006600; font-style: italic;">// Code ausführen, wenn DIV Element vorhanden. Funktioniert!</span>
<span style="color: #009900;">&#125;</span></pre></div></div><p>Der Selektor ist in purem Javascript auf die div id beschränkt. Sehr ärgerlich ist das hierbei keine Klassen selektiert werden können. <a href="/119/jquery-prufen-ob-ein-element-existiert/" title="jQuery: prüfen ob ein Element existiert">jQuery</a> bietet diese Möglichkeit.</p> ]]></content:encoded> <wfw:commentRss>http://www.monkey-business.biz/672/javascript-prufen-ob-ein-element-existiert/feed/</wfw:commentRss> <slash:comments>3</slash:comments> </item> <item><title>jQuery Interfaces Fisheye position: fixed; Patch</title><link>http://www.monkey-business.biz/181/jquery-interfaces-fisheye-position-fixed-patch/</link> <comments>http://www.monkey-business.biz/181/jquery-interfaces-fisheye-position-fixed-patch/#comments</comments> <pubDate>Mon, 04 Jan 2010 20:20:43 +0000</pubDate> <dc:creator>Loaden</dc:creator> <category><![CDATA[Belästigung der Allgemeinheit - mein privater Weblog]]></category> <category><![CDATA[Bugfix]]></category> <category><![CDATA[Fisheye]]></category> <category><![CDATA[Javascript]]></category> <category><![CDATA[jQuery]]></category> <category><![CDATA[position: fixed;]]></category><guid isPermaLink="false">http://www.monkey-business.biz/?p=181</guid> <description><![CDATA[(to the english part of the post)Dir wird in diesem Artikel der neue jQuery Interfaces Fisheye position: fixed; Patch zum herunterladen angeboten. Mit diesem Bugfix funktioniert das Fisheye auch nach dem Scrollen bei fixer Positionierung. Die Vorgehensweise ist denkbar einfach. Es muss nur der Bugfix nach der jQuery interfaces Datei eingebunden werden. Ein Beispiel folgt. [...]]]></description> <content:encoded><![CDATA[<p><a href="#jquery-interfaces-fisheye-position-fixed-patch_english">(to the english part of the post)</a><a name="jquery-interfaces-fisheye-position-fixed-patch_deutsch"></a><br />Dir wird in diesem Artikel der neue jQuery Interfaces Fisheye position: fixed; Patch zum herunterladen angeboten. Mit diesem Bugfix funktioniert das Fisheye auch nach dem Scrollen bei fixer Positionierung. Die Vorgehensweise ist denkbar einfach. Es muss nur der Bugfix nach der jQuery interfaces Datei eingebunden werden. Ein Beispiel folgt.</p><div class="wp_syntax"><div class="code"><pre class="html4strict" style="font-family:monospace;"><span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">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;jquery.js&quot;</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">script</span>&gt;</span> <span style="color: #808080; font-style: italic;">&lt;!--- jQuery Framework einbinden ---&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;interface.js&quot;</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">script</span>&gt;</span> <span style="color: #808080; font-style: italic;">&lt;!--- jQuery interfaces Plugin einbinden ---&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;fisheye_patched.js&quot;</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">script</span>&gt;</span> <span style="color: #808080; font-style: italic;">&lt;!--- hier den Bugfix einbinden ---&gt;</span></pre></div></div><h3><a href="/wp-content/uploads/2010/01/fisheye_patched.zip" title="Fisheye position: fixed; Bugfix herunterladen">Fisheye position: fixed; Bugfix herunterladen</a></h3><p>Zip Datei enthält Javascript Datei.</p><p>Weitere Verweise zum Thema:</p><ul><li><a href="/wp-content/uploads/2010/05/fisheye/index.html" title="Patch Demo" target="_blank">jQuery Interface Fisheye Fix Demo</a></li><li><a href="/wp-content/uploads/2010/02/interfaces.zip">jQuery Interface herunterladen</a></li><li><a href="http://www.ndesign-studio.com/blog/mac/css-dock-menu" target="_blank">jQuery Interface Fisheye Anleitung</a></li></ul><hr /> <a href="#jquery-interfaces-fisheye-position-fixed-patch_deutsch">(Zum deutschen Teil des Artikels)</a><br /> <a name="jquery-interfaces-fisheye-position-fixed-patch_english"></a><p>In this post you will be offered to download the jQuery Interfaces Fisheye position: fixed; patch. With this patch the Fisheye works after scrolling while it&#8217;s fixed positioned. The procedure is simple. You only need to include the bugfix after including the jQuery inferfaces file. An example follows.</p><div class="wp_syntax"><div class="code"><pre class="html4strict" style="font-family:monospace;"><span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">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;jquery.js&quot;</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">script</span>&gt;</span> <span style="color: #808080; font-style: italic;">&lt;!--- include jQuery Framework ---&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;interface.js&quot;</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">script</span>&gt;</span> <span style="color: #808080; font-style: italic;">&lt;!--- include jQuery interfaces plugin ---&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;fisheye_patched.js&quot;</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">script</span>&gt;</span> <span style="color: #808080; font-style: italic;">&lt;!---include the bugfix ---&gt;</span></pre></div></div><h3><a href="/wp-content/uploads/2010/01/fisheye_patched.zip" title="Fisheye position: fixed; bugfix download">Fisheye position: fixed; bugfix download</a></h3><p>Zip file includes javascript file.</p><p>More links to this subject:</p><ul><li><a href="/wp-content/uploads/2010/05/fisheye/index.html" title="Fixed demo" target="_blank">jQuery Interface Fisheye fix demo</a></li><li><a href="/wp-content/uploads/2010/02/interfaces.zip">jQuery Interface download</a></li><li><a href="http://www.ndesign-studio.com/blog/mac/css-dock-menu" target="_blank">jQuery Interface Fisheye tutorial</a></li></ul> ]]></content:encoded> <wfw:commentRss>http://www.monkey-business.biz/181/jquery-interfaces-fisheye-position-fixed-patch/feed/</wfw:commentRss> <slash:comments>30</slash:comments> </item> <item><title>jQuery: prüfen ob ein Element existiert</title><link>http://www.monkey-business.biz/119/jquery-prufen-ob-ein-element-existiert/</link> <comments>http://www.monkey-business.biz/119/jquery-prufen-ob-ein-element-existiert/#comments</comments> <pubDate>Tue, 22 Dec 2009 18:31:02 +0000</pubDate> <dc:creator>Loaden</dc:creator> <category><![CDATA[Belästigung der Allgemeinheit - mein privater Weblog]]></category> <category><![CDATA[Entwicklung]]></category> <category><![CDATA[Framework]]></category> <category><![CDATA[Javascript]]></category> <category><![CDATA[jQuery]]></category><guid isPermaLink="false">http://www.monkey-business.biz/?p=119</guid> <description><![CDATA[Ich stand vor kurzem vor dem Problem in Javascript zu prüfen ob ein DIV Element in einem HTML Dokument existiert. Mir stand aus vorangehender Entwicklung das jQuery Framework zur Verfügung. Dabei produzierte ich folgenden Code: if &#40;$&#40;'div#divname'&#41;&#41; &#123; // Code ausführen, wenn DIV Element vorhanden. Funktioniert leider nicht &#125; Das klappte leider nicht, da der [...]]]></description> <content:encoded><![CDATA[<p>Ich stand vor kurzem vor dem Problem in <a href="/672/javascript-prufen-ob-ein-element-existiert/" title="Javascript: prüfen ob ein Element existiert">Javascript zu prüfen ob ein DIV Element</a> in einem HTML Dokument existiert. Mir stand aus vorangehender Entwicklung das jQuery Framework zur Verfügung. Dabei produzierte ich folgenden Code:</p><div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'div#divname'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
<span style="color: #006600; font-style: italic;">// Code ausführen, wenn DIV Element vorhanden. Funktioniert leider nicht</span>
<span style="color: #009900;">&#125;</span></pre></div></div><p>Das klappte leider nicht, da der Einsatz der jQuery Selektor Funktion immer ein Objekt zurückliefert. Mir war klar das es sich hierbei um ein leeres Objekt handelt und ich nur auf die Länge prüfen müsste. Sollte die Länge 0 sein ist der DIV im aktuellen Dokument nicht vorhanden. Hier nun der Code mit dem es entgültig klappte:</p><div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'div#divname'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">length</span> <span style="color: #339933;">&gt;</span> <span style="color: #CC0000;">0</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
<span style="color: #006600; font-style: italic;">// Code ausführen, wenn DIV Element vorhanden. Funktioniert!</span>
<span style="color: #009900;">&#125;</span></pre></div></div><p>Ich verwende &gt; anstatt ==, da diese Methode auch bei CSS Klassen funktioniert und keine Nachteile in der Performance bietet. Klassen können mehrfach im Dokument vorkommen. Deswegen kann die Länge größer als 1 sein.</p><p><a href="http://api.jquery.com/category/selectors/" target="_blank" title="Selektoren - jQuery API">Mehr zum Thema jQuery Selektoren</a></p> ]]></content:encoded> <wfw:commentRss>http://www.monkey-business.biz/119/jquery-prufen-ob-ein-element-existiert/feed/</wfw:commentRss> <slash:comments>2</slash:comments> </item> </channel> </rss>
<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Minified using disk: basic
Page Caching using disk: enhanced (User agent is rejected)
Database Caching 5/14 queries in 0.012 seconds using disk: basic

Served from: www.monkey-business.biz @ 2012-02-05 01:57:12 -->
