<?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>Christoph Schüßler » jQuery is fun! &#187; User Interface</title>
	<atom:link href="http://herr-schuessler.de/blog/topics/ui/feed/" rel="self" type="application/rss+xml" />
	<link>http://herr-schuessler.de/blog</link>
	<description>Christoph Schüßler plans, designs and codes websites, creates user experience and simplifies human computer interaction.</description>
	<lastBuildDate>Tue, 27 Apr 2010 17:18:09 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>jQuery.popeye 2.0 released</title>
		<link>http://herr-schuessler.de/blog/jquery-popeye-2-0/</link>
		<comments>http://herr-schuessler.de/blog/jquery-popeye-2-0/#comments</comments>
		<pubDate>Tue, 13 Apr 2010 10:24:23 +0000</pubDate>
		<dc:creator>Christoph Schüßler</dc:creator>
				<category><![CDATA[User Interface]]></category>
		<category><![CDATA[XHTML & CSS]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[english]]></category>
		<category><![CDATA[gallery]]></category>
		<category><![CDATA[image]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[lightbox]]></category>
		<category><![CDATA[plugin]]></category>
		<category><![CDATA[update]]></category>

		<guid isPermaLink="false">http://herr-schuessler.de/blog/?p=311</guid>
		<description><![CDATA[I have just released a new major version of my popular image gallery script jQuery.popeye. It features more customization options, better cross browser and mobile support and tons of bugfixes. I have set up a jQuery.popeye site where you can find documentation and demos. You will also find links to a new feature request forum [...]]]></description>
			<content:encoded><![CDATA[<p>I have just released a new major version of my popular image gallery script jQuery.popeye. It features more customization options, better cross browser and mobile support and tons of bugfixes.<br />
<span id="more-311"></span></p>
<p>I have set up a <a href="http://dev.herr-schuessler.de/jquery/popeye/">jQuery.popeye site</a> where you can find <a href="http://dev.herr-schuessler.de/jquery/popeye/doc.html">documentation</a> and <a href="http://dev.herr-schuessler.de/jquery/popeye/demo.html">demos</a>.</p>
<p>You will also find links to a new feature request forum and bug tracker there. Hope you like the new stuff!</p>
]]></content:encoded>
			<wfw:commentRss>http://herr-schuessler.de/blog/jquery-popeye-2-0/feed/</wfw:commentRss>
		<slash:comments>58</slash:comments>
		</item>
		<item>
		<title>jQuery.popeye &#8211; an inline lightbox alternative</title>
		<link>http://herr-schuessler.de/blog/jquerypopeye-an-inline-lightbox-alternative/</link>
		<comments>http://herr-schuessler.de/blog/jquerypopeye-an-inline-lightbox-alternative/#comments</comments>
		<pubDate>Tue, 11 Nov 2008 20:15:19 +0000</pubDate>
		<dc:creator>Christoph Schüßler</dc:creator>
				<category><![CDATA[User Interface]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[english]]></category>
		<category><![CDATA[gallery]]></category>
		<category><![CDATA[image]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[lightbox]]></category>
		<category><![CDATA[plugin]]></category>

		<guid isPermaLink="false">http://herr-schuessler.de/?p=101</guid>
		<description><![CDATA[jQuery.popeye 2.0 has been released. Older Versions are no longer supported. Writing the history of single-page image galleries on the web, one could start like this: In the beginning, there was nothing. And the Developer said: &#8220;Let there be pop-ups!&#8221; And the Users saw that pop-ups were bad… Then came Lightbox. Finally, an unobtrusive script [...]]]></description>
			<content:encoded><![CDATA[<div class="redirect">
<a href="http://dev.herr-schuessler.de/jquery/popeye/">jQuery.popeye 2.0</a> has been released. Older Versions are no longer supported.
</div>
<p>Writing the history of single-page image galleries on the web, one could start like this:</p>
<blockquote><p>In the beginning, there was nothing. And the Developer said: &#8220;Let there be pop-ups!&#8221; And the Users saw that pop-ups were bad…</p></blockquote>
<p><span id="more-101"></span></p>
<p>Then came <a href="http://www.lokeshdhakar.com/projects/lightbox2/">Lightbox</a>. Finally, an unobtrusive script allowed to display enlarged versions of thumbnail images embedded in web pages without leaving that web page or breaking the layout. The &#8220;simple&#8221; solution was to add a semi-transparent overlay to the page, on which the enlarged image is centered.</p>
<p>Since then, we&#8217;ve seen <a href="http://fortysomething.ca/mt/etc/archives/005400.php">a ton of similar scripts</a> used on an ever-increasing number of websites.</p>
<p>While at first, I, like everyone else, was really enthusiastic about this technique, I have come to see some of the downsides of a lightbox-ish image presentation:</p>
<ul>
<li>Lightboxes are usually <strong>not consistent with the look &amp; feel</strong> of the rest of the website, and</li>
<li>they <em>still feel like a kind of pop-up</em>, since the image leaves the layer of the web page and <strong>opens up a new layer</strong>.</li>
</ul>
<p>Besides &#8211;  I&#8217;m getting tired of seeing the same effect, the same UI controls over and over…</p>
<p>So, while working on a client project in which I at first used a <a href="http://www.balupton.com/sandbox/jquery_lightbox/">jQuery Lightbox plugin</a>, I ended up dissatisfied with the outcome. I had gone through great length to stir up a consistent look &amp; feel, just to see it vanish under the lightbox overlay.</p>
<p>I wanted something more integrated in the flow of the web page &#8211; a box with a small preview image with caption, the possibility to flip through an array of more thumbnails and, of course, to show an enlarged version, all in one place. Lightbox offers that. Moreover, I wanted the box to stay anchored to the page layout and not hovering above it disconnectedly. The way to achieve this was writing a script which would fix one corner of the enlarged image to the exact spot where the thumbnail had been.</p>
<p>After toying around for a while, I decided to put the final outcome into a proper jQuery plugin and see, what other people (you!) think. May <em>jQuery.popeye</em> be of use!</p>
<h4>Behavior</h4>
<p>The plugin transforms an unoredered list of images into a box displaying only one preview image at a time. The box has controls to skim through the preview images and to enlarge a given image. The box expands to accomodate the enlarged version, while the controls are hidden in full image size mode. A simple click on the image returns the box to its compact state.</p>
<p>The compact box has fixed, automatically calculated dimensions. The widht and height are calculated so that all thumbnail images are cropped to the smallest width and height in the set and centered resulting image area (<em>stage</em>).</p>
<p>This behaviour can be overriden in the plugin options.</p>
<p>I have set up a <a href="http://dev.herr-schuessler.de/examples/jquery-popeye/">demo page which best shows the behavior of <em>jQuery.popeye</em></a>.</p>
<h4>Usage</h4>
<p><em>jQuery.popeye</em> degrades gracefully into a scrollable list of thumbnails which link to an enlarged version. The <strong>HTML-setup</strong> should look like this:</p>
<pre name="code" class="html">
<div class="popeye">
<ul>
<li><a href="url_of_large_image.jpg">
			<img src="url_of_thumbnail.jpg" alt="The caption string" /></a></li>
<li><a href="url_of_large_image.jpg">
			<img src="url_of_thumbnail.jpg" alt="The caption string" /></a></li>
<li><a href="url_of_large_image.jpg">
			<img src="url_of_thumbnail.jpg" alt="The caption string" /></a></li>
<li>...</li>
</ul>
</div>
</pre>
<p>Once the plugin has been included in your web page, the popeye(es) can be easily created with the following command:</p>
<pre name="code" class="js">$(document).ready(function () {
	$('.popeye').popeye();
});</pre>
<p>Of course, multiple popeyees can be used together on a single page.</p>
<h4>Customization</h4>
<p><em>jQuery.popeye</em> supports a wide range of options. They are, in detail:</p>
<table class="table" border="0">
<tbody>
<tr>
<th>Option</th>
<th>Type</th>
<th>Default</th>
<th>Description</th>
</tr>
<tr>
<td class="hilite"><code>stageW</code></td>
<td>string</td>
<td>n/a</td>
<td>override width of compact image stage (e.g. <code>'200px'</code>)</td>
</tr>
<tr>
<td class="hilite"><code>stageH</code></td>
<td>string</td>
<td>n/a</td>
<td>override height of compact image stage (e.g. <code>'200px'</code>)</td>
</tr>
<tr>
<td class="hilite"><code>jclass</code></td>
<td>string</td>
<td><code>'popeye-hasjs'</code></td>
<td>class to be applied to popeye-box when the browser has activated JavaScript (to overwrite fallback styling)</td>
</tr>
<tr>
<td class="hilite"><code>eclass</code></td>
<td>string</td>
<td><code>'popeye-haspopped'</code></td>
<td>class to be applied to enlarged popeye-box</td>
</tr>
<tr>
<td class="hilite"><code>lclass</code></td>
<td>string</td>
<td><code>'popeye-isloading'</code></td>
<td>class to be applied to stage while loading image</td>
</tr>
<tr>
<td class="hilite"><code>direction</code></td>
<td>string</td>
<td><code>'left'</code></td>
<td>direction that popeye-box opens, can be <code>'left'</code> or <code>'right'</code></td>
</tr>
<tr>
<td class="hilite"><code>duration</code></td>
<td>integer</td>
<td><code>400</code></td>
<td>duration of transitional effect when enlarging or closing the box</td>
</tr>
<tr>
<td class="hilite"><code>easing</code></td>
<td>string</td>
<td><code>'swing'</code></td>
<td>easing type, can be <code>'swing'</code>, <code>'linear'</code> or any of <a href="http://gsgd.co.uk/sandbox/jquery/easing/">jQuery Easing Plugin</a> types (Plugin required)</td>
</tr>
<tr>
<td class="hilite"><code>nlabel</code></td>
<td>string</td>
<td><code>'next'</code></td>
<td>label for next button</td>
</tr>
<tr>
<td class="hilite"><code>plabel</code></td>
<td>string</td>
<td><code>'previous'</code></td>
<td>label for previous button</td>
</tr>
<tr>
<td class="hilite"><code>oflabel</code></td>
<td>string</td>
<td><code>'of'</code></td>
<td>label for image count text (e.g. 1 <em>of</em> 14)</td>
</tr>
<tr>
<td class="hilite"><code>blabel</code></td>
<td>string</td>
<td><code>'enlarge'</code></td>
<td>label for enlarge button</td>
</tr>
<tr>
<td class="hilite"><code>clabel</code></td>
<td>string</td>
<td><code>'Click to close'</code></td>
<td>tooltip on enlarged image (click image to close)</td>
</tr>
</tbody>
</table>
<p><strong>Update:</strong> These are the options for <em>jQuery.popeye 0.2</em>. The <a href="http://herr-schuessler.de/blog/jquery-popeye-1-0-released/">options for the latest version have changed</a>!</p>
<p>To overwrite the default parameters, you can use the following code:</p>
<pre name="code" class="js">var options = {
	direction:  'right',
	duration:   230,
	stageW:     '200px',
	stageH:     '240px'
}
$('.popeye').popeye(options);</pre>
<p>The plugin comes with the mandatory css-file <code>jquery.popeye.css</code> which shouldn&#8217;t be altered. Additionally, I have included a second, customizable CSS-file with an example style for you to build upon.</p>
<h4>I repeat&#8230;</h4>
<ul>
<li>Get the <a href="http://jquery.com/">latest version of jQuery</a>,</li>
<li>(optional) get the <a href="http://gsgd.co.uk/sandbox/jquery/easing/">jQuery Easing Plugin</a>,</li>
<li>see it in action on <a href="http://dev.herr-schuessler.de/examples/jquery-popeye/">the demo page</a>,</li>
<li>get the plugin:</li>
</ul>
<p><a class="download" href="http://plugins.jquery.com/project/popeye">Download <em>jQuery.popeye</em><br />
from the jQuery Plugin Repository</a></p>
<h4>Considerations</h4>
<p>There are still some issues with the first release of <em>jQuery.popeye</em> which I hope to resolve in future versions. They mainly concern the size of the enlarged box (the whole image should stay visible) and the gallery controls (will introduce proper controls to enlarged box).</p>
<p>But for now, your <strong>feedback</strong>, <strong>bug reports</strong>, <strong>improvements</strong> and <strong>feature requests</strong> are very welcome in the comment section.</p>
<blockquote><p>&#8220;I yam what I yam!&#8221; — Popeye</p></blockquote>
<div class="redirect">
<a href="http://dev.herr-schuessler.de/jquery/popeye/">jQuery.popeye 2.0</a> has been released. Older Versions are no longer supported.
</div>
]]></content:encoded>
			<wfw:commentRss>http://herr-schuessler.de/blog/jquerypopeye-an-inline-lightbox-alternative/feed/</wfw:commentRss>
		<slash:comments>105</slash:comments>
		</item>
		<item>
		<title>CSS Image Rollover &#8211; Final Words</title>
		<link>http://herr-schuessler.de/blog/css-image-rollover-final-words/</link>
		<comments>http://herr-schuessler.de/blog/css-image-rollover-final-words/#comments</comments>
		<pubDate>Wed, 31 Oct 2007 13:51:07 +0000</pubDate>
		<dc:creator>Christoph Schüßler</dc:creator>
				<category><![CDATA[User Interface]]></category>
		<category><![CDATA[XHTML & CSS]]></category>
		<category><![CDATA[Deutsch]]></category>

		<guid isPermaLink="false">http://tutorials.anestetic.net/index.php/2007/10/31/css-image-rollover-final-words/</guid>
		<description><![CDATA[In zwei Tutorials hatte ich bereits vorgestellt, wie sich Rollover, also Grafik-Links, die sich beim überfahren mit der Maus ändern, am besten per CSS gestalten lassen. Dieses Tutorial geht noch einen letzten Schritt weiter und fügt eine Kleinigkeit hinzu, die bisher fehlte: den Linktext. In den vorherigen Tutorials und Beispielen hatte ich diesen weggelassen, damit [...]]]></description>
			<content:encoded><![CDATA[<p>In <a href="http://herr-schuessler.de/blog/css-image-rollover-best-practice/">zwei</a> <a href="http://herr-schuessler.de/blog/css-image-rollover-revisited/">Tutorials</a> hatte ich bereits vorgestellt, wie sich Rollover, also Grafik-Links, die sich beim überfahren mit der Maus ändern, am besten per CSS gestalten lassen. Dieses Tutorial geht noch einen letzten Schritt weiter und fügt eine Kleinigkeit hinzu, die bisher fehlte: den Linktext.<br />
<span id="more-15"></span></p>
<p>In den vorherigen Tutorials und Beispielen hatte ich diesen weggelassen, damit die Hintergrundgrafiken, die einem Rollover-Link per CSS zugewiesen werden, nicht vom Linktext, also dem Text zwischen dem öffnenden und schließenden <code>&lt;a&gt;</code>, überlagert werden.</p>
<p><strong>Unschön!</strong> Der entstehende Code hat keine semantische Aussagekraft, von derSuchmaschinenfreundlichkeit ganz zu schweigen. Außerdem zeigen ältere Browser bei Einsatz dieser Technik dann gar nichts an, der Link wird also unsichtbar für den Benutzer. Kurz gesagt: ein Link sollte immer einen Ankertext haben.</p>
<p>Hier also der Code verbesserte Rollover-Code:</p>
<pre name="code" class="html">
<a href="#" class="rollover" id="rollover1">Linktext 1</a>
</pre>
<pre name="code" class="css">
a.rollover {
	display: block;
	float: left;
	width: XYpx; /* Breite einer Rollover-Status-Grafik  */
	height: 0px !important;
	padding-top: XYpx; /* Höhe einer Rollover-Status-Grafik */
	overflow: hidden;
}
#rollover1 {
	background: url(rollover.png) no-repeat left 0px;
}
#meinRollover1:hover {
	background: url(rollover.png) no-repeat left -XYpx; /* Höhe einer Rollover-Status-Grafik (negativ) */
}
#rollover1:active {
	background: url(rollover.png) no-repeat left -XYpx; /* doppelte Höhe einer Rollover-Status-Grafik (negativ) */
}
</pre>
<p>Dabei verwende ich wieder eine Grafik, in der die drei Rollover-Stati übereinander in einer einzigen Datei abgespeichert sind, die dann jeweils nur in ihrer Position als Hintergrundgrafik der Links verschoben wird. Dies geschieht durch die Angabe des negativen Abstands in Pixeln zum oberen Rand der Grafik. Neu ist, dass der Linktext zwar da ist, durch die CSS-Anweisungen aber so weit nach unten verschoben wird, dass er nicht mehr über der Grafik liegt, sondern unsichtbar wird.</p>
<p>Wie das Ergebnis genau aussieht, zeigt <a href="http://dev.herr-schuessler.de/examples/css-image-rollover-final-words/rollover4.html">dieses Beispiel</a>.</p>
<p>Kompatibel mit folgenden Browsern:</p>
<ul>
<li>Mozilla 1.7</li>
<li>Firefox 1+</li>
<li>Opera 9+</li>
<li>Safari (Windows) 3+</li>
<li>Internet Explorer 6+ (allerdings keine Anzeige des dritten Status :active)</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://herr-schuessler.de/blog/css-image-rollover-final-words/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>CSS Image Rollover &#8211; Revisited</title>
		<link>http://herr-schuessler.de/blog/css-image-rollover-revisited/</link>
		<comments>http://herr-schuessler.de/blog/css-image-rollover-revisited/#comments</comments>
		<pubDate>Wed, 22 Nov 2006 17:20:01 +0000</pubDate>
		<dc:creator>Christoph Schüßler</dc:creator>
				<category><![CDATA[User Interface]]></category>
		<category><![CDATA[XHTML & CSS]]></category>
		<category><![CDATA[Deutsch]]></category>

		<guid isPermaLink="false">http://xhtml.anestetic.net/index.php/2006/11/22/css-image-rollover-revisited/</guid>
		<description><![CDATA[Im letzten Artikel hatte ich beschrieben, wie sich durch Kombinieren von mehreren Rollover-Grafiken in eine Datei erstens Dateigröße und zweitens Reaktionszeit des Rollovers verringern lassen. In diesem Artikel möchte ich diese Taktik auf die Spitze treiben. Wir werden drei Rollover in einer Datei kombinieren und so die Dateigröße weiter drücken &#8211; das ganze natürlich Standardkompatibel [...]]]></description>
			<content:encoded><![CDATA[<p>Im <a href="http://dev.herr-schuessler.de/index.php/2006/09/22/css-image-rollover-best-practice/">letzten Artikel</a> hatte ich beschrieben, wie sich durch Kombinieren von mehreren Rollover-Grafiken in eine Datei erstens Dateigröße und zweitens Reaktionszeit des Rollovers verringern lassen. In diesem Artikel möchte ich diese Taktik auf die Spitze treiben. Wir werden drei Rollover in einer Datei kombinieren und so die Dateigröße weiter drücken &#8211; das ganze natürlich Standardkompatibel und ohne JavaScript.<br />
<span id="more-7"></span></p>
<p>CSS bietet zur Positionierung von Hintergrundgrafiken die 5 Werte <code>left</code>, <code>right</code>, <code>top</code>, <code>bottom </code>und <code>center</code>, wobei <code>center</code> sowohl vertikale als auch horizontale Positionierung einschließt. Aus diesen 5 Werten lässt sich also eine Matrix mit 9 verschiedenen Positionen erstellen:</p>
<table class="table">
<tr>
<td><code>left top</code></td>
<td class="acenter"><code>center top</code></td>
<td class="aright"><code>right top</code></td>
</tr>
<tr>
<td><code>left center</code></td>
<td class="acenter"><code>center center</code></td>
<td class="aright"><code>right center</code></td>
</tr>
<tr>
<td><code>left bottom</code></td>
<td class="acenter"><code>center bottom</code></td>
<td class="aright"><code>right bottom</code></td>
</tr>
</table>
<p>Genau wie diese Matrix lässt sich auch eine Grafik aufbauen, die 3 verschiedene Grafiken mit jeweils 3 Rollover-Stati vereint. Doch zunächst zu den einzelnen Rollover-Grafiken. Ich will auf meiner Website 3 Rollover mit jeweils verschiedenen Grafiken einbauen. Dazu lege ich drei Grafiken an, die jeweils die drei gewünschten Rollover-Stati enthalten (<code>normal</code>, <code>mouseover </code>und <code>click</code>):</p>
<div class="img">
<img id="image10" src="http://herr-schuessler.de/wp/wp-content/uploads/2006/11/rollover_combined_left.gif" alt="Rollover Combined Left" /></p>
<div class="caption">Bild 1 hat eine Dateigröße von 8,16 KB</div>
</div>
<div class="img"><img id="image9" src="http://herr-schuessler.de/wp/wp-content/uploads/2006/11/rollover_combined_center.gif" alt="Rollover Combined Center" /></p>
<div class="caption">Bild 2 hat eine Dateigröße von 3,76 KB</div>
</div>
<div class="img"><img id="image11" src="http://herr-schuessler.de/wp/wp-content/uploads/2006/11/rollover_combined_right.gif" alt="Rollover Combined Right" /></p>
<div class="caption">Bild 3 hat eine Dateigröße von 6,18 KB, macht also insgesamt  18,1 KB. </div>
</div>
<p>Durch folgenden Code lässt sich nun aus jeder dieser Grafiken ein Rollover erstellen:</p>
<pre name="code" class="html">
<a href="#" id="meinRollover1"></a>
</pre>
<pre name="code" class="css">
#meinRollover1 {
	display:block;
	width: 106px;
	height: 118px;
	background: #FFF url(rollover.gif) no-repeat left top;
}
#meinRollover1:hover {
	background: #FFF url(rollover.gif) no-repeat left center;
}
#meinRollover1:active {
	background: #FFF url(rollover.gif) no-repeat left bottom;
}
</pre>
<p>Dabei geben <code>width </code>und <code>height </code>natürlich die Dimensionen <strong>nur eines</strong> der Einzelbilder, die die verschiedenen Stati darstellen, an (<a href="http://dev.herr-schuessler.de/examples/css-image-rollover-revisited/rollover2.html">Beispiel</a>).</p>
<p>Nun kombiniere ich, wie in obiger Matrix, alle 9 Einzelbilder in einer einzigen Datei:</p>
<div class="img"><img id="image8" src="http://herr-schuessler.de/wp/wp-content/uploads/2006/11/rollover_combined.gif" alt="Rollover Combined" /></div>
<p>Dabei achte ich darauf, dass jedes Einzelbild auch entsprechend seiner CSS-Positionierung in der Datei platziert wird. Jedem Einzelbild wird also genau so viel Platz eingeräumt, wie das größte Einzelbild beansprucht. Ebenso platziere ich die Einzelbilder entsprechend der CSS-Matrix, das Einzelbild zum Beipspiel, das nach der CSS-Matrix sowohl vertikal als auch horizontal zentriert wird, muss also auch in der Datei ebenso zentriert werden. Dies lässt sich in Photoshop besonders leicht durch die Verwendung von Hilfslinien erreichen. Zur Verdeutlichung hier nochmal die kombinierte Grafik mit eingezeichneten Hilfslinien:</p>
<div class="img"><img id="image12" src="http://herr-schuessler.de/wp/wp-content/uploads/2006/11/rollover_combined_hilflinie.gif" alt="Rollover Combined mit Hilfslinien" /></div>
<p>Mit folgendem Code erstelle ich nun 3 völlig voneinander unabhängige Rollover-Links, die alle nur diese einzige Datei verwenden:</p>
<pre name="code" class="html">
<a href="#" id="meinRollover1"></a>
<a href="#" id="meinRollover2"></a>
<a href="#" id="meinRollover3"></a>
</pre>
<pre name="code" class="css">
a {
	display:block;
}
#meinRollover1 {
	width: 106px;
	height: 118px;
	background: #FFF url(rollover_combined.gif) no-repeat left top;
}
#meinRollover1:hover {
	background: #FFF url(rollover_combined.gif) no-repeat left center;
}
#meinRollover1:active {
	background: #FFF url(rollover_combined.gif) no-repeat left bottom;
}
#meinRollover2 {
	width: 44px;
	height: 79px;
	background: #FFF url(rollover_combined.gif) no-repeat center top;
}
#meinRollover2:hover {
	background: #FFF url(rollover_combined.gif) no-repeat center center;
}
#meinRollover2:active {
	background: #FFF url(rollover_combined.gif) no-repeat center bottom;
}
#meinRollover3 {
	width: 104px;
	height: 73px;
	background: #FFF url(rollover_combined.gif) no-repeat right top;
}
#meinRollover3:hover {
	background: #FFF url(rollover_combined.gif) no-repeat right center;
}
#meinRollover3:active {
	background: #FFF url(rollover_combined.gif) no-repeat right bottom;
}
</pre>
<p>Jedem einzelnen Rollover werden dabei die Dimensionen zugewiesen, die das tatsächliche Einzelbild beansprucht, die Positionierungwerte werden aus der CSS-Matrix übernommen.<br />
<a href="http://dev.herr-schuessler.de/examples/css-image-rollover-revisited/rollover3.html">Hier ein funktionierendes Beispiel der 3 Rollover.</a></p>
<p>Das Resultat: Die kombinierte Grafik belegt 14,6 KB, was gegenüber den Deteigrößen der drei einzelnen Grafiken (zusammen 18,1 KB) einer Reduzierung von 20% entspricht.</p>
]]></content:encoded>
			<wfw:commentRss>http://herr-schuessler.de/blog/css-image-rollover-revisited/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>CSS Image Rollover &#8211; Best practice</title>
		<link>http://herr-schuessler.de/blog/css-image-rollover-best-practice/</link>
		<comments>http://herr-schuessler.de/blog/css-image-rollover-best-practice/#comments</comments>
		<pubDate>Fri, 22 Sep 2006 15:24:51 +0000</pubDate>
		<dc:creator>Christoph Schüßler</dc:creator>
				<category><![CDATA[User Interface]]></category>
		<category><![CDATA[XHTML & CSS]]></category>
		<category><![CDATA[Deutsch]]></category>

		<guid isPermaLink="false">http://xhtml.anestetic.net/index.php/2006/09/22/css-image-rollover-best-practice/</guid>
		<description><![CDATA[Zum Einstieg in mein neues Blog, in dem ich XHTML- und CSS-Tutorials schreiben werde, möchte ich einen Überblick über den neusten Stand beim Thema Image Rollover geben. Sicherlich sind jedem noch die 50 Zeilen Javascript-Code bekannt, die Adobe ImageReady produziert, um Links mit grafischen Rollover zu versehen. Dabei wurde bei Mouseover über ein Grafik per [...]]]></description>
			<content:encoded><![CDATA[<p>Zum Einstieg in mein neues Blog, in dem ich XHTML- und CSS-Tutorials schreiben werde, möchte ich einen Überblick über den neusten Stand beim Thema Image Rollover geben.<br />
<span id="more-3"></span></p>
<p>Sicherlich sind jedem noch die 50 Zeilen Javascript-Code bekannt, die Adobe ImageReady produziert, um Links mit grafischen Rollover zu versehen. Dabei wurde bei Mouseover über ein Grafik per Javascript der Pfad dieser Grafik durch den Pfad einer Anderen ersetzt. Die Ersatz-Grafiken müssen dabei vorher, ebenfalls per Javascript, in den Browser vorgeladen werden, damit beim Rollover keine Verzögerung auftritt. Obwohl diese Technik inzwischen veraltet ist, produziert ImageReady leider weiterhin diese Lösung.</p>
<p>Die Nachteile dabei sind:</p>
<ul>
<li>Aufspaltung der Rollover-Grafik in 2 Grafiken, dadurch müssen auch 2 HTTP-Requests abgefeuert werden um die Grafiken vom Server zu holen, was sich auf die Ladezeit der Site auswirken kann (wenn viele Rollover benutzt werden),</li>
<li>50 Zeilen Javascript zuviel,</li>
<li>ImageReady bedient sich keiner externen Event-Handler, sondern platziert die Javascript-Aufrufe in den Link-Tags (mittels onmouseover, onmouseout, etc). Dies ließe sich natürlich beheben leicht beheben, doch</li>
<li>der Effekt funktioniert sowieso nicht bei ausgeschaltetem Javascript (D&#8217;Oh).</li>
</ul>
<p>Glücklicherweise gibt es eine Lösung, die ohne Javascript auskommt und dabei ohne CSS-Hacks in allen modernen Browsern funktionieren sollte.</p>
<p>Nehmen wir folgende Grafik:</p>
<div class="img"><img alt="Rollover-Grafik 1" id="image4" src="http://herr-schuessler.de/wp/wp-content/uploads/2006/09/alter_rollover1.png" /></div>
<p>Diese soll mit einem Rollover versehen werden, so dass sie bei Mouseover folgendes anzeigt:</p>
<div class="img"><img alt="Rollover-Grafik 2" id="image5" src="http://herr-schuessler.de/wp/wp-content/uploads/2006/09/alter_rollover2.png" /></div>
<p>Getrennt habe beide Grafiken eine  Dateigröße von knapp 8 Kb und es sind 2 HTTP-Requests nötig, um beide abzurufen.</p>
<p>Kombinieren wir beide Grafiken in eine, indem wir die Höhe der Grafikdatei auf 200% aufziehen und die zweite Grafik unterhalb der ersten platzieren, erhalten wir folgendes:</p>
<div class="img"><img id="image6" alt="Rollover-Grafik 3" src="http://herr-schuessler.de/wp/wp-content/uploads/2006/09/rollover1.png" /></div>
<p>Das Resultat: knapp 7 Kb Dateigröße, ein HTTP-Request &#8211; Ladezeit verringert, Ziel 1 erreicht.</p>
<p>Doch wie wird die Grafik nun eingebunden, damit nicht beide Rollover-Stati gleichzeitig zu sehen sind? Nehmen wir folgenden XHTML-Code</p>
<pre name="code" class="html">
<a href="#" id="meinRollover1"></a>
</pre>
<p>und fügen folgendes als CSS dazu</p>
<pre name="code" class="css">
#meinRollover1 {
	display:block;
	width: 126px;
	height: 151px;
	background: #FFF url(rollover1.png) no-repeat top;
}
</pre>
<p>Zeile 1: Die Umstellung des Inline-Elements A auf ein Block-Level-Element bewirkt, dass wir diesem eine Höhe und Breite zuweisen können. Natürlich nehmen wir hier die Dimensionen der Grafik, als Höhe allerdings die halbe Höhe, also die ursprüngliche Höhe des Teils der Grafik, den wir anzeigen möchten. In Zeile 4 wird die Grafik dem Link dann als Hintergrundbild zugewiesen.</p>
<p>So weit, so gut. Wie kommt nun der Rollover-Effekt zu Stande? Glüclicherweise unterstützen alle Browser den Einsatz des Pseudolements :hover bei Links (bei anderen Elementen tut sich der IE6 immer noch schwer, ihm kann allerdings mit Einbindung der <a href="http://www.xs4all.nl/~peterned/csshover.html">csshover.htc</a> geholfen werden, was wiederrum dazu führt, dass das CSS-Stylesheet nicht mehr korrekt validiert).</p>
<p>Fügen wir also eine weitere CSS-Beschrebung ein:</p>
<pre name="code" class="css">
#meinRollover1:hover {
	background: #FFF url(rollover1.png) no-repeat bottom;
}
</pre>
<p>Eine einzige Zeile CSS reicht hier aus, um den gewünschten Effekt zu erzeugen. Die Hintergrundgrafik wird beim :hover-Status einfach unten ausgerichtet, und das Licht geht an (<a href="http://dev.herr-schuessler.de/examples/css-image-rollover-best-practice/rollover1.html">Beispiel</a>).</p>
<p>Natürlich gib es auch Situationen, in denen man anderen Elementen als einem Link einen grafischen Rollover zuweisen möchte. Hierbei ist, wie oben schon erwähnt, zu beachten, dass nicht alle Browser :hover bei anderen Elementen wie z.B. DIV unterstützen. Hier kann man entweder A-Elemente als Layout-Elemente verwenden, sie per Javascript mittels void(0) deaktivieren und evtl. den Cursor ändern, damit der Benutzer nicht merkt, dass es sich um einen Link handelt. Dies ist aber semantsich nicht korrekt, denn in XHTML ist ein Link ein Link und sollte so verwendet werden.</p>
<p>Stattdessen kann man vorerst nur die Datei csshover.htc in sein Sytlesheet einbinden</p>
<pre name="code" class="css">
html, body {
	behavior:url("csshover.htc");
}
</pre>
<p>was allerdings dann kein valides CSS mehr ist, und darauf warten, dass <del datetime="2006-10-08T11:07:37+00:00">zukünftige Browsergenerationen (Winke Winke, IE7) hier bessere Unterstützung für :hover bieten.</del> <a href="http://blogs.msdn.com/ie/archive/2006/10/06/IE7-Is-Coming-This-Month_2E002E002E00_Are-you-Ready_3F00_.aspx">IE7 wirklich schnell übernommen wird</a>, hier ist <a href="http://blogs.msdn.com/ie/archive/2006/08/22/712830.aspx">das Problem nämlich gelöst</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://herr-schuessler.de/blog/css-image-rollover-best-practice/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
	</channel>
</rss>
