<?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>EeepZork!&#187; DHTML</title>
	<atom:link href="http://labs.elektrikcoma.com/blog/tag/dhtml/feed/" rel="self" type="application/rss+xml" />
	<link>http://labs.elektrikcoma.com/blog</link>
	<description>The unofficial offical comaLABS blog.</description>
	<lastBuildDate>Fri, 06 Nov 2009 07:24:34 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.5</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>a little &#8220;Web 2.0&#8243; on this chilly monday.</title>
		<link>http://labs.elektrikcoma.com/blog/code/a-little-web-20-on-this-chilly-monday/</link>
		<comments>http://labs.elektrikcoma.com/blog/code/a-little-web-20-on-this-chilly-monday/#comments</comments>
		<pubDate>Mon, 16 Feb 2009 20:25:41 +0000</pubDate>
		<dc:creator>Mikael C. Fritts</dc:creator>
				<category><![CDATA[AJAX]]></category>
		<category><![CDATA[Code]]></category>
		<category><![CDATA[DHTML]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[Web App]]></category>

		<guid isPermaLink="false">http://labs.elektrikcoma.com/blog/?p=36</guid>
		<description><![CDATA[Seeing as I tout myself as a UI Web Designer/Developer I decided to actually post something that is relevant to my &#8220;field&#8221;. I don&#8217;t really use this script that much myself, not because it&#8217;s not functional, just that I haven&#8217;t really had any projects that could benefit from it. 
So what is it already?
It&#8217;s a [...]]]></description>
			<content:encoded><![CDATA[<p>Seeing as I tout myself as a UI Web Designer/Developer I decided to actually post something that is relevant to my &#8220;field&#8221;. I don&#8217;t really use this script that much myself, not because it&#8217;s not functional, just that I haven&#8217;t really had any projects that could benefit from it. </p>
<p>So what is it already?</p>
<p>It&#8217;s a simple tool tip script written in JavaScript (or DHTML if you will). Basically when your user mouses over a specified link a tool top will be displayed. You&#8217;ve seen this kind of script before, it&#8217;s actually pretty hard NOT to see it in use in today&#8217;s web world. I got tired of the regular &#8220;box&#8221; look and made it a bit more &#8220;Web 2.0&#8243;. Anyways, here comes the code. </p>
<p>All files are available in .rar format <a href="http://labs.elektrikcoma.com/bubble_tip.rar" title">here</a> and are free to download. Below I will explain the different aspects of the code and how to implement it. </p>
<p>The meat &#038; potato&#8217;s: The JavaScript.</p>
<p><code><br />
function showToolTip(e,text){<br />
	if(document.all)e = event;<br />
	var obj = document.getElementById('bubble_tooltip');<br />
	var obj2 = document.getElementById('bubble_tooltip_content');<br />
	obj2.innerHTML = text;<br />
	obj.style.display = 'block';<br />
	var st = Math.max(document.body.scrollTop,document.documentElement.scrollTop);<br />
	if(navigator.userAgent.toLowerCase().indexOf('safari')>=0)st=0;<br />
	var leftPos = e.clientX - 100;<br />
	if(leftPos&lt;0)leftPos = 0;<br />
	obj.style.left = leftPos + 'px';<br />
	obj.style.top = e.clientY - obj.offsetHeight -1 + st + 'px';<br />
}<br />
function hideToolTip()<br />
{<br />
document.getElementById('bubble_tooltip').style.display = 'none';<br />
}<br />
</code><br />
There really aren&#8217;t customizable variables in there, and I wouldn&#8217;t recommend changing anything unless you have a working knowledge of JavaScript. Make sure you include the JS file in the &lt;head&gt; of your document!</p>
<p>The customizable part: CSS.</p>
<p><code><br />
#bubble_tooltip{<br />
	width: 147px;<br />
	position: absolute;<br />
	display: none;<br />
}<br />
#bubble_tooltip .bubble_top{<br />
	background-image: url('../images/bubble_top.gif'); /*DEFINE THIS PATH!!! */<br />
	background-repeat: no-repeat;<br />
	height: 16px;<br />
}<br />
#bubble_tooltip .bubble_middle{<br />
	background-image: url('../images/bubble_middle.gif'); /*DEFINE THIS PATH!!! */<br />
	background-position: bottom left;<br />
	padding-left: 7px;<br />
	padding-right: 7px;<br />
}<br />
#bubble_tooltip .bubble_middle span{<br />
	position: relative;<br />
	top: -8px;<br />
	font-family: Trebuchet MS, Lucida Sans Unicode, Arial, sans-serif;<br />
	font-size: 11px;<br />
}<br />
#bubble_tooltip .bubble_bottom{<br />
	background-image: url('../images/bubble_bottom.gif'); /*DEFINE THIS PATH!!! */<br />
	background-repeat: no-repeat;<br />
	background-repeat: no-repeat;<br />
	height: 44px;<br />
	position: relative;<br />
	top: -6px;<br />
}<br />
</code><br />
Add the above CSS into your pre-existing CSS file. Modify the colors, font face, font size, etc&#8230; Make SURE you upload the image files to a specified directory and make sure your CSS reflects that. </p>
<p>Now implement the tool tip in your page. This can be used in an anchor tag or a span tag. I&#8217;ve included examples of both. </p>
<p>Using it with an anchor tag:<br />
<code><br />
&lt;a href="page.html" onmousemove="showToolTip(event,'This is where your text will go. Change at will!');return false" onmouseout="hideToolTip()">Focus Word&lt;/a&gt;<br />
</code>  </p>
<p>Using it with a span:<br />
<code><br />
&lt;span class="tooltip_text" href="page.html" onmousemove="showToolTip(event,'This is where your text will go. Change at will!');return false" onmouseout="hideToolTip()">Focus Word&lt;/span&gt;<br />
</code></p>
<p>There you have it.</p>
]]></content:encoded>
			<wfw:commentRss>http://labs.elektrikcoma.com/blog/code/a-little-web-20-on-this-chilly-monday/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
