<?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>UH.LEE.KA &#187; MooTips</title>
	<atom:link href="http://www.uhleeka.com/blog/tag/mootips/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.uhleeka.com/blog</link>
	<description>If you think nobody cares about you, try missing a few car payments.</description>
	<lastBuildDate>Wed, 25 Aug 2010 01:35:57 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>MooTools.Tips Port v1.1 to v1.2</title>
		<link>http://www.uhleeka.com/blog/2008/11/mootoolstips-convert-v11-to-v12/</link>
		<comments>http://www.uhleeka.com/blog/2008/11/mootoolstips-convert-v11-to-v12/#comments</comments>
		<pubDate>Sat, 22 Nov 2008 01:23:13 +0000</pubDate>
		<dc:creator>uhleeka</dc:creator>
				<category><![CDATA[Scripting]]></category>
		<category><![CDATA[MooTips]]></category>
		<category><![CDATA[MooTools]]></category>

		<guid isPermaLink="false">http://www.uhleeka.com/blog/?p=78</guid>
		<description><![CDATA[Converting an old v1.1 implementation of basic MooTips to v1.2 requires just a couple of steps. However, keep in mind that the 1.2 Tips object is strictly meant as a tool tip. You cannot hover over the tip, so there is no built-in way to add interactivity with your tip. First, the CSS needs to [...]]]></description>
			<content:encoded><![CDATA[<div style="float:left;width:93px;height:93px;margin:8px 8px 0px 0px;border:solid 1px #000;background-repeat:no-repeat;background-position:-40px -30px;background-image:url('http://www.uhleeka.com/blog/wp-content/uploads/2008/11/mootools.png');"></div>
<p>Converting an old v1.1 implementation of basic MooTips to v1.2 requires just a couple of steps.  However, keep in mind that the 1.2 Tips object is strictly meant as a tool tip.  You cannot hover over the tip, so there is no built-in way to add interactivity with your tip.  <span id="more-78"></span></p>
<p>First, the CSS needs to be changed because the underlying element structure of the tip has changed (see a prior post on <a href="http://www.uhleeka.com/blog/2008/11/mootools-tips-mootips/">MooTools.Tips in v1.2</a> for example css).</p>
<p>The new html structure looks like the following:</p>

<div class="uhleeka_codebox"><div class="uhleeka_codebox_in"><pre>&lt;div class="options.className"&gt;
&nbsp; &lt;div class="tip-top"&gt;&lt;/div&gt;
&nbsp; &lt;div class="tip"&gt;
&nbsp; &nbsp; &lt;div class="tip-title"&gt;&lt;/div&gt;
&nbsp; &nbsp; &lt;div class="tip-text"&gt;&lt;/div&gt;
&nbsp; &lt;/div&gt;
&nbsp; &lt;div class="tip-bottom"&gt;&lt;/div&gt;
&lt;/div&gt;</pre></div></div>

<p>Next, you need to import your Title::Text from the &#8220;title&#8221; attribute of your tip anchor.</p>

<div class="uhleeka_codebox"><div class="uhleeka_codebox_in"><pre>&lt;span id="myTip" title="This is the title::This is the text"&gt;
&nbsp; Hover over me to see a tooltip
&lt;/span&gt;
&lt;span id="myTipAjax" title="AJAX::myurl.html"&gt;
&nbsp; Hover over me to see a tooltip retrieved via MooTools.Request
&lt;/span&gt;</pre></div></div>

<p>The following function parses out the &#8220;Title::Text&#8221; from the tip anchor and uses element storage to assign it to the tip.  It can also handle an &#8220;AJAX::url&#8221; format (Note the double colon).</p>

<div class="uhleeka_codebox"><div class="uhleeka_codebox_in"><pre>function SetTipStorage(element) {
&nbsp; &nbsp; // create an array including the title at
&nbsp; &nbsp; // position 0 and the text at position 1
&nbsp; &nbsp; var content = element.get('title').split('::');&nbsp;  

&nbsp; &nbsp; switch(content[0]) {
&nbsp; &nbsp; &nbsp; &nbsp; case 'AJAX':
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; var req = new Request({
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; url: content[1],
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; method: 'get',
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; onFailure: function(xhr) {
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; element.store('tip:title', 'ERROR');
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; element.store('tip:text', 'Ajax request failed');
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; },
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; onSuccess: function(responseText, responseXML) {
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; content = responseText.split('::');
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // use the element storage functionality 
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // to store the title and text for the 
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // specified element
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; element.store('tip:title', content[0]);&nbsp;  
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; element.store('tip:text', content[1]);
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // remove the element title
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; element.title = '';
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; });
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; req.send();
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; break;
&nbsp; &nbsp; &nbsp; &nbsp; default:
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // use the element storage functionality 
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // to store the title and text for the 
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // specified element
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; element.store('tip:title', content[0]);&nbsp;  
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; element.store('tip:text', content[1]);
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // remove the element title
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; element.title = '';
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; break;
&nbsp; &nbsp; }
}</pre></div></div>

<p>Finally, the last thing to do is to wire up the Tips at &#8220;domready&#8221;:</p>

<div class="uhleeka_codebox"><div class="uhleeka_codebox_in"><pre>window.addEvent('domready', function() {
&nbsp; &nbsp; var tips = new Tips();
&nbsp; &nbsp;  
&nbsp; &nbsp; SetTipStorage($('myTip'));
&nbsp; &nbsp; tips.attach($('myTip'), {
&nbsp; &nbsp; &nbsp; &nbsp; fixed: false,
&nbsp; &nbsp; &nbsp; &nbsp; showDelay: 0,
&nbsp; &nbsp; &nbsp; &nbsp; hideDelay: 0
&nbsp; &nbsp; });
&nbsp; &nbsp; SetTipStorage($('myTipAjax'));
&nbsp; &nbsp; tips.attach($('myTipAjax'), {
&nbsp; &nbsp; &nbsp; &nbsp; fixed: true,
&nbsp; &nbsp; &nbsp; &nbsp; showDelay: 0,
&nbsp; &nbsp; &nbsp; &nbsp; hideDelay: 0
&nbsp; &nbsp; });
});</pre></div></div>

<p>See the full code and demo at <a href="http://www.uhleeka.com/archives/mootools/1.2.1/tips-convert-v11/">http://www.uhleeka.com/archives/mootools/1.2.1/tips-convert-v11/</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.uhleeka.com/blog/2008/11/mootoolstips-convert-v11-to-v12/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>MooTools.Tips v1.2</title>
		<link>http://www.uhleeka.com/blog/2008/11/mootools-tips-mootips/</link>
		<comments>http://www.uhleeka.com/blog/2008/11/mootools-tips-mootips/#comments</comments>
		<pubDate>Tue, 18 Nov 2008 03:09:50 +0000</pubDate>
		<dc:creator>uhleeka</dc:creator>
				<category><![CDATA[Scripting]]></category>
		<category><![CDATA[MooTips]]></category>
		<category><![CDATA[MooTools]]></category>

		<guid isPermaLink="false">http://www.uhleeka.com/blog/?p=60</guid>
		<description><![CDATA[Back in the days of MooTools v1.1, MooTips was an external class designed to use an element&#8217;s &#8220;title&#8221; attribute to control the content of the tip. See a demo of the 1.1 version. MooTools v1.2 includes a &#8220;Tips&#8221; class which operates very differently from the v1.1 extension. Browse the online documentation. Breaking it down&#8230; Download [...]]]></description>
			<content:encoded><![CDATA[<div style="float:left;width:93px;height:93px;margin:8px 8px 0px 0px;border:solid 1px #000;background-repeat:no-repeat;background-position:-40px -30px;background-image:url('http://www.uhleeka.com/blog/wp-content/uploads/2008/11/mootools.png');"></div>
<p>Back in the days of MooTools v1.1, MooTips was an external class designed to use an element&#8217;s &#8220;title&#8221; attribute to control the content of the tip.  See a demo of the <a href="http://www.uhleeka.com/archives/mootools/1.1/mootips/" target="_blank">1.1 version</a>.</p>
<p>MooTools v1.2 includes a &#8220;Tips&#8221; class which operates very differently from the v1.1 extension.  Browse the <a href="http://mootools.net/docs/Plugins/Tips" target="_blank">online documentation</a>.  <span id="more-60"></span></p>
<h4>Breaking it down&#8230;</h4>
<p>Download the MooTools <a href="http://mootools.net/download" target="_blank">core library</a> and use the <a href="http://mootools.net/more">more builder</a> to download the additional &#8220;Tips&#8221; functionality.  Include the files in the head of your page:</p>

<div class="uhleeka_codebox"><div class="uhleeka_codebox_in"><pre>&lt;script type="text/javascript" src="mootools-1.2.1-core-yc.js"&gt;&lt;/script&gt;
&lt;script type="text/javascript" src="mootools-1.2-more.js"&gt;&lt;/script&gt;</pre></div></div>

<p>Add the tooltip css:</p>

<div class="uhleeka_codebox"><div class="uhleeka_codebox_in"><pre>&lt;style type="text/css"&gt;
/* MooTools.Tips */
.tip-top {
&nbsp; &nbsp; color: #fff;
&nbsp; &nbsp; width: 139px;
&nbsp; &nbsp; z-index: 13000;
}
.tip-title {
&nbsp; &nbsp; width: 123px;
&nbsp; &nbsp; font-weight: bold;
&nbsp; &nbsp; font-size: 11px;
&nbsp; &nbsp; margin: 0;
&nbsp; &nbsp; color: #9FD4FF;
&nbsp; &nbsp; padding: 8px 8px 4px;
&nbsp; &nbsp; background: url(bubble.png) top left;
}
.tip-text {
&nbsp; &nbsp; width: 123px;
&nbsp; &nbsp; font-size: 11px;
&nbsp; &nbsp; padding: 4px 8px 8px;
&nbsp; &nbsp; background: url(bubble.png) bottom right;
&nbsp; &nbsp; color:#fff;
}
.tip-text A {
&nbsp; &nbsp; color:#069;
}
.tip-loading {
&nbsp; &nbsp; background: url(ajax_load.gif) center center no-repeat;
&nbsp; &nbsp; width: 30px;
&nbsp; &nbsp; height: 30px;
&nbsp; &nbsp; margin: 0 auto;
}
&lt;/style&gt;</pre></div></div>

<p>Add an element to tooltip:</p>

<div class="uhleeka_codebox"><div class="uhleeka_codebox_in"><pre>&lt;body&gt;
&nbsp; &lt;img src="moo.png" id="simple_tip" /&gt;
&lt;/body&gt;</pre></div></div>

<p>Using javascript, set the Title and Text to be displayed in the tip:</p>

<div class="uhleeka_codebox"><div class="uhleeka_codebox_in"><pre>$('simple_tip').store('tip:title', "This is the Title");
$('simple_tip').store('tip:text', "This is the Text");</pre></div></div>

<p>And finally, create the tip:</p>

<div class="uhleeka_codebox"><div class="uhleeka_codebox_in"><pre>var SimpleTip = new Tips($('simple_tip'), {
&nbsp; showDelay: 0,
&nbsp; hideDelay: 0,
&nbsp; offsets: {x: 10, y: 10},
&nbsp; fixed: false
});</pre></div></div>

<p>Check the full source code and a working <a href="http://www.uhleeka.com/archives/mootools/1.2.1/tips-simple" target="_blank">v1.2 simple Tips demo</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.uhleeka.com/blog/2008/11/mootools-tips-mootips/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
	</channel>
</rss>
