<?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>In usability we trust &#187; Code</title>
	<atom:link href="http://www.svennerberg.com/category/code/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.svennerberg.com</link>
	<description>Web Applications Designed for Humans</description>
	<lastBuildDate>Mon, 14 Nov 2011 10:29:51 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Tinyrotator &#8211; a tiny image rotator  plugin for jQuery</title>
		<link>http://www.svennerberg.com/2011/05/tinyrotator-a-tiny-image-rotator-plugin-for-jquery/</link>
		<comments>http://www.svennerberg.com/2011/05/tinyrotator-a-tiny-image-rotator-plugin-for-jquery/#comments</comments>
		<pubDate>Fri, 20 May 2011 12:21:57 +0000</pubDate>
		<dc:creator>Gabriel Svennerberg</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[Plugin]]></category>

		<guid isPermaLink="false">http://www.svennerberg.com/?p=3204</guid>
		<description><![CDATA[For a project I worked on recently I created a small and simple image rotator plugin for jQuery. It&#8217;s dead easy to embed in your own page and to style the way you want using regular CSS. The plugin is &#8230; <a href="http://www.svennerberg.com/2011/05/tinyrotator-a-tiny-image-rotator-plugin-for-jquery/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p><img src="http://media.svennerberg.com/2011/05/tinyrotator-150.jpg" alt="" class="alignright size-full wp-image-3233" />For a project I worked on recently I created a small and simple image rotator plugin for jQuery. It&#8217;s dead easy to embed in your own page and to style the way you want using regular CSS. </p>
<p>The plugin is released under both <a href="http://jquery.org/license/">MIT and GPL licenses</a> so you can use it any way you want in both personal and commercial projects.</p>
<p><span id="more-3204"></span></p>
<h2>How to use it</h2>
<p>First of all you need to include the <code>tinyrotator.css</code> and <code>jquery.tinyrotator.js</code> files in your document. The stylesheet  will give you a standard design but you can easily change it by altering the CSS file. Since it&#8217;s a jQuery plugin you will of course also have to include the jQuery library.</p>
<p>The base of the  plugin is an unordered list of images with links to bigger images. The list should have the <code>class="tinyrotator"</code> to get the correct style from the stylesheet. You can of course use a different class (or id) if you create your own custom CSS.</p>
<pre name="code" class="html">
&lt;ul class="tinyrotator"&gt;
  &lt;li&gt;
    &lt;a href="image1.jpg"&gt;
      &lt;img src="thumbnail1.jpg" alt="" /&gt;
    &lt;/a&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;a href="image1.jpg"&gt;
      &lt;img src="thumbnail2.jpg" alt="" /&gt;
    &lt;/a&gt;
  &lt;/li&gt;
&lt;/ul&gt;
</pre>
<p>The plugin is then activated by calling the tinyrotator method on the list like this:</p>
<pre name="code" class="js">
$(document).ready(function() {
  $('.tinyrotator').tinyrotator();
});
</pre>
<p>This will produce a standard image rotator with the images from your list. The plugin will show the bigger versions of the images above the thumbnails and automatically cycle through them. If the user clicks a thumbnail, that image will be shown and the plugin will stop rotating.</p>
<div id="attachment_3245" class="wp-caption alignnone" style="width: 235px"><img src="http://media.svennerberg.com/2011/05/tinyrotator1.jpg" alt="" class="size-full wp-image-3245" /><p class="wp-caption-text">A standard version of Tinyrotator</p></div>
<h2>Graceful degradation</h2>
<p>If for some reason the plugin won&#8217;t initialize (user has JavaScript turned of, jQuery din&#8217;t load, etc.) a clickable list of the images will still be visible and the user will be able to click them to watch their bigger counterparts. They will however be opened on a blank page.</p>
<div id="attachment_3248" class="wp-caption alignnone" style="width: 237px"><img src="http://media.svennerberg.com/2011/05/tinyrotator-javascript-disabled.jpg" alt="" class="size-full wp-image-3248" /><p class="wp-caption-text">Tinyrotator with JavaScript turned off</p></div>
<h2>Options</h2>
<p>The plugin has two options with which you can set the time each image should be visible and how fast the transition (a fade) between two images should be.</p>
<dl class="spec">
<dt>interval</dt>
<dd>The time in millisecond that each image will be displayed<br />
		Default value is 5000.</dd>
<dt>fade</dt>
<dd>The speed of the fade, possible values are: &#8216;fast&#8217;, &#8216;slow&#8217;, &#8216;medium&#8217;, &#8216;none&#8217; or the time in milliseconds<br />
		Default value is &#8216;medium&#8217;</dd>
</dl>
<p>Here&#8217;s an example where both the interval and the fade speed has a faster pace.</p>
<pre name="code" class="js">
$(document).ready(function() {
  $('.tinyrotator').tinyrotator({
	interval: 2000,
	fade: 'fast'
  });
});
</pre>
<p>Be sure to check out the demo to see the plugin in action. Also check out the source of the demo page to see how to use it.</p>
<div class="call-to-action">
<a href="http://www.svennerberg.com/code/tinyrotator/index.html" class="btn primary large">View Demo</a> <a href="https://github.com/svennerberg/tinyrotator" class="btn primary large" title="Download TinyRotator from Github">Download <span>(from Github)</span></a>
</div>
<h2>Feedback</h2>
<p>I hope you&#8217;ll find the plugin useful. If you have any suggestions on how the plugin could be improved, please let me know in the comments. Also if you use it on a project it&#8217;s always fun if you let me know. </p>
]]></content:encoded>
			<wfw:commentRss>http://www.svennerberg.com/2011/05/tinyrotator-a-tiny-image-rotator-plugin-for-jquery/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Announcing MapTooltip</title>
		<link>http://www.svennerberg.com/2009/03/announcing-maptooltip/</link>
		<comments>http://www.svennerberg.com/2009/03/announcing-maptooltip/#comments</comments>
		<pubDate>Tue, 31 Mar 2009 20:28:31 +0000</pubDate>
		<dc:creator>Gabriel Svennerberg</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[Extension]]></category>
		<category><![CDATA[Google Maps]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[Library]]></category>

		<guid isPermaLink="false">http://www.svennerberg.com/?p=1695</guid>
		<description><![CDATA[One of the shortcomings in the Google Maps API is that there&#8217;s no easy way to add tooltips to polylines and polygons. That&#8217;s why I felt inclined to build an extension to Google Maps that adds that functionality. MapTooltip makes &#8230; <a href="http://www.svennerberg.com/2009/03/announcing-maptooltip/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>One of the shortcomings in the  Google Maps API is that there&#8217;s no easy way to add tooltips to polylines and polygons. That&#8217;s why I felt inclined to build an extension to Google Maps that adds that functionality. MapTooltip makes it possible to add tooltips to any kind of overlay. It&#8217;s even possible to have HTML inside it and to style it to fit your design needs.</p>
<p><img src="http://media.svennerberg.com/2009/03/screenshot1.png" alt="" class="alignnone border" /></p>
<p><span id="more-1695"></span></p>
<h3>About MapTooltip</h3>
<p>In a project I&#8217;m working on there&#8217;s a need to have tooltips on polylines. I have tried to find simple ways of doing this but haven&#8217;t been able to find any. After researching this and eventually coming up with a solution I decided to package it into a small library so that I could share it with fellow Google Maps developers.</p>
<h3>Reference</h3>
<p>The constructor creates an object of the type MapTooltip. It takes two required arguments and one optional.</p>
<p><code>MapTooltip(reference:object, tooltip:string, opts?:object)</code></p>
<h4>reference</h4>
<p>The first argument, <code>reference</code>, is a reference to the overlay that you will attach the tooltip to, for example a GPolyline. </p>
<h4>tooltip</h4>
<p>The second argument, <code>tooltip</code>, is a string containing what will appear inside of the tooltip. You can either provide just a plain text string or some HTML.</p>
<h4>opts</h4>
<p>The third argument which is optional, <code>opts</code>, is an object literal that contains all options on how the tooltip will look and behave. It can have the following settings:</p>
<ul>
<li><strong>width</strong><br />
The width of the tooltip, ex: &#8220;100px&#8221;</li>
<li><strong>padding</strong><br />
The padding around the content of the tooltip<br />
For a 3px padding: &#8220;3px&#8221;<br />
For a 2px top/bottom padding and a 5px left/right padding: &#8220;2px 5px&#8221;</li>
<li><strong>backgroundColor</strong><br />
Backgroundcolor of the tooltip, ex: &#8220;#ff9&#8243;</li>
<li><strong>color</strong><br />
The color of the text inside the tooltip, ex: &#8220;#000&#8243;</li>
<li><strong>border</strong><br />
The styling of the border of the tooltip, ex: &#8220;1px solid green&#8221;</li>
<li><strong>fontSize</strong><br />
The size of the text inside the tooltip, ex: &#8220;1em&#8221;</li>
<li><strong>offsetX</strong><br />
The horizontal distance in pixels from the pointer to the tooltip, ex &#8220;10&#8243;</li>
<li><strong>offsetY</strong><br />
The vertical distance in pixels from the pointer to the tooltip, ex: &#8220;10&#8243;</li>
</ul>
<p>It might for example look like this:</p>
<pre name="code" class="js">
var options = {
    'width': '250px',
    'border': '3px dotted #00f'
}
</pre>
<h3>Using MapTooltip</h3>
<p>To use MapTooltip is pretty easy. First add a Google Map as you normally would. Then follow the steps below to attach a tooltip to an object in the map.</p>
<h4>1. Load the library</h4>
<p>Import the library to the web page with the script tag.</p>
<pre name="code" class="html">
&lt;script src="http://maptooltip.googlecode.com/files/mapTooltip.js" type="text/javascript"&gt;&lt;/script&gt;</code>
</pre>
<h4>2. Attach appropriate events</h4>
<p>Add a mouseover event to the object on your map that you wish to have a tooltip. You will also have to add a mouseout event that removes the tooltip.</p>
<pre name="code" class="js">
// Attach mouseover event to a polyline that will trigger the tooltip
GEvent.addListener(polyline, 'mouseover', function() {
	this.overlay = new MapTooltip(this, 'This is a polyline');
	map.addOverlay(this.overlay);
	// Attach mousout event to the polyline that will delete the tooltip
	GEvent.addListener(polyline, 'mouseout', function() {
		map.removeOverlay(this.overlay);
	});
});
</pre>
<p>That&#8217;s it. Be sure to <a href="http://www.svennerberg.com/examples/maptooltip/"> check out the live demo</a> to see it in action. The demo includes tooltips attached to markers, polylines and polygons. One of the tooltip is styled in a different way using the <code>opts</code> parameter.</p>
<div class="image">
<a href="http://www.svennerberg.com/examples/maptooltip/" title="The live demo page of MapToolTip"><img src="http://media.svennerberg.com/2009/03/demo-410x398.png" alt="" class="alignnone" /></a></p>
<p><a href="http://www.svennerberg.com/examples/maptooltip/">Check out the live demo</a></p>
</div>
<h3>Copyright</h3>
<p>MapTooltip is released under the <a href="http://www.opensource.org/licenses/mit-license.php">MIT License</a> and is free for any use. </p>
<h3>Downloads</h3>
<p><a href="http://maptooltip.googlecode.com/files/mapTooltip.js">mapTooltip.js</a></p>
<h3> Acknowledgments</h3>
<p>MapTooltip is heavily influenced by the article <a href="http://danmarvelo.us/older/2007/9/10/custom-info-window-for-google/">Custom Info Window / Popup for Google Maps, or Loving the GOverlay</a>. </p>
<h3>Known bugs</h3>
<p>If you import the Google Maps API with ver=2.x it&#8217;s not going to work as expected since it seems that it doesn&#8217;t handle mouseover events on GMap2 when the pointer is over an GOverlay quite the same way as in previous versions. I don&#8217;t know if this is a temporary glitch or if it&#8217;s supposed to work this way in the future.</p>
<p class="note"><strong>Update [2009-04-11]:</strong> In the latest release of the Google Maps API the above mentioned problems currently occur. I will try to find a way around, but until then you can stick to version 2.151 to make it work correctly.</p>
<p>For ideas on this or for other bugs you might encounter, please contact me either in the comments or through the <a href="http://www.svennerberg.com/contact/">Contact page</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.svennerberg.com/2009/03/announcing-maptooltip/feed/</wfw:commentRss>
		<slash:comments>19</slash:comments>
		</item>
	</channel>
</rss>

