<?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>Carbon Five Community &#187; jQuery</title>
	<atom:link href="http://blog.carbonfive.com/tag/jquery/feed" rel="self" type="application/rss+xml" />
	<link>http://blog.carbonfive.com</link>
	<description></description>
	<lastBuildDate>Fri, 27 Aug 2010 00:24:40 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Absolutize for jQuery</title>
		<link>http://blog.carbonfive.com/2008/09/javascript-ajax/absolutize-for-jquery</link>
		<comments>http://blog.carbonfive.com/2008/09/javascript-ajax/absolutize-for-jquery#comments</comments>
		<pubDate>Thu, 11 Sep 2008 22:34:15 +0000</pubDate>
		<dc:creator>james</dc:creator>
				<category><![CDATA[JavaScript / AJAX]]></category>
		<category><![CDATA[jQuery]]></category>

		<guid isPermaLink="false">http://blog.carbonfive.com/?p=194</guid>
		<description><![CDATA[We&#8217;re using jQuery for one of our current projects. Today I found myself in an IE situation that could be solved by using the prototype librarie&#8217;s absolutize method. I couldn&#8217;t find any equivilent implementation that I liked in jQuery so I went ahead and ported absolutize from prototype to jquery. Download Here It can be [...]]]></description>
			<content:encoded><![CDATA[<p>We&#8217;re using jQuery for one of our current projects. Today I found myself in an IE situation that could be solved by using the prototype librarie&#8217;s <a href="http://www.prototypejs.org/api/element/absolutize">absolutize method</a>. I couldn&#8217;t find any equivilent implementation that I liked in jQuery so I went ahead and ported absolutize from prototype to jquery.</p>
<p><a href="http://plugins.jquery.com/project/absolutize_prototype_port">Download Here</a></p>
<p>It can be used in the standard jQuery way, like so:</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;">$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;color: blue;">'some-selector'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">absolutize</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span></pre></div></div>

<p>Here&#8217;s the code:</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;">jQuery.<span style="color: #660066;">fn</span>.<span style="color: #660066;">absolutize</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>
  <span style="color: #000066; font-weight: bold;">return</span> <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">each</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> element <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: #339933;">;</span>
    <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>element.<span style="color: #660066;">css</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;color: blue;">'position'</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">==</span> <span style="color: #3366CC;color: blue;">'absolute'</span><span style="color: #009900;">&#41;</span>
    <span style="color: #009900;">&#123;</span>
      <span style="color: #000066; font-weight: bold;">return</span> element<span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
&nbsp;
    <span style="color: #003366; font-weight: bold;">var</span> offsets <span style="color: #339933;">=</span> element.<span style="color: #660066;">offset</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #003366; font-weight: bold;">var</span> top <span style="color: #339933;">=</span> offsets.<span style="color: #660066;">top</span><span style="color: #339933;">;</span>
    <span style="color: #003366; font-weight: bold;">var</span> left <span style="color: #339933;">=</span> offsets.<span style="color: #660066;">left</span><span style="color: #339933;">;</span>
    <span style="color: #003366; font-weight: bold;">var</span> width <span style="color: #339933;">=</span> element<span style="color: #009900;">&#91;</span><span style="color: #CC0000;">0</span><span style="color: #009900;">&#93;</span>.<span style="color: #660066;">clientWidth</span><span style="color: #339933;">;</span>
    <span style="color: #003366; font-weight: bold;">var</span> height <span style="color: #339933;">=</span> element<span style="color: #009900;">&#91;</span><span style="color: #CC0000;">0</span><span style="color: #009900;">&#93;</span>.<span style="color: #660066;">clientHeight</span><span style="color: #339933;">;</span>
&nbsp;
    element._originalLeft <span style="color: #339933;">=</span> left <span style="color: #339933;">-</span> parseFloat<span style="color: #009900;">&#40;</span>element.<span style="color: #660066;">css</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;color: blue;">&quot;left&quot;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">||</span> <span style="color: #CC0000;">0</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    element._originalTop <span style="color: #339933;">=</span> top <span style="color: #339933;">-</span> parseFloat<span style="color: #009900;">&#40;</span>element.<span style="color: #660066;">css</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;color: blue;">&quot;top&quot;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">||</span> <span style="color: #CC0000;">0</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    element._originalWidth <span style="color: #339933;">=</span> element.<span style="color: #660066;">css</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;color: blue;">&quot;width&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    element._originalHeight <span style="color: #339933;">=</span> element.<span style="color: #660066;">css</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;color: blue;">&quot;height&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
    element.<span style="color: #660066;">css</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;color: blue;">&quot;position&quot;</span><span style="color: #339933;">,</span> <span style="color: #3366CC;color: blue;">&quot;absolute&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    element.<span style="color: #660066;">css</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;color: blue;">&quot;top&quot;</span><span style="color: #339933;">,</span> top <span style="color: #339933;">+</span> <span style="color: #3366CC;color: blue;">'px'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    element.<span style="color: #660066;">css</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;color: blue;">&quot;left&quot;</span><span style="color: #339933;">,</span> left <span style="color: #339933;">+</span> <span style="color: #3366CC;color: blue;">'px'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    element.<span style="color: #660066;">css</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;color: blue;">&quot;width&quot;</span><span style="color: #339933;">,</span> width <span style="color: #339933;">+</span> <span style="color: #3366CC;color: blue;">'px'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    element.<span style="color: #660066;">css</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;color: blue;">&quot;height&quot;</span><span style="color: #339933;">,</span> height <span style="color: #339933;">+</span> <span style="color: #3366CC;color: blue;">'px'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #000066; font-weight: bold;">return</span> element<span style="color: #339933;">;</span>
&nbsp;
  <span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://blog.carbonfive.com/2008/09/javascript-ajax/absolutize-for-jquery/feed</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
	</channel>
</rss>
