<?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>Papermashup.com &#187; MooTools</title>
	<atom:link href="http://papermashup.com/category/mootools/feed/" rel="self" type="application/rss+xml" />
	<link>http://papermashup.com</link>
	<description>Ashley Ford :: CSS &#124; PHP &#124; JavaScript</description>
	<lastBuildDate>Wed, 07 Jul 2010 09:39:45 +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>Using Highcharts JavaScript Library</title>
		<link>http://papermashup.com/using-highcharts-javascript-library/</link>
		<comments>http://papermashup.com/using-highcharts-javascript-library/#comments</comments>
		<pubDate>Tue, 12 Jan 2010 10:17:12 +0000</pubDate>
		<dc:creator>Ashley</dc:creator>
				<category><![CDATA[API's]]></category>
		<category><![CDATA[Blogging]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[Design]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[MooTools]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[Web Tools]]></category>
		<category><![CDATA[headline]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[charts]]></category>
		<category><![CDATA[graphs]]></category>

		<guid isPermaLink="false">http://papermashup.com/?p=1507</guid>
		<description><![CDATA[There are some great JavaScript graph libraries out there and one that&#8217;s recently come to my attention is Highcharts.com which is compatible with both the jQuery and Mootools frameworks. To get started point your browser here where you can download all the files you need including examples.  Highcharts features include slick tooltips to reference points on your charts, it&#8217;s compatible with all standard web browsers, the setup for a graph as demonstrated below is simple and uses the JSON data type, there are also ...]]></description>
			<content:encoded><![CDATA[<p>There are some great JavaScript graph libraries out there and one that&#8217;s recently come to my attention is <a href="http://highcharts.com">Highcharts.com</a> which is compatible with both the jQuery and Mootools frameworks. To get started point your browser <a href="http://www.highcharts.com/">here</a> where you can download all the files you need including examples.  Highcharts features include slick tooltips to reference points on your charts, it&#8217;s compatible with all standard web browsers, the setup for a graph as demonstrated below is simple and uses the JSON data type, there are also multiple types of graph type, from  line, spline, area, areaspline, column, bar, pie and scatter chart.</p>
<p><img src="http://papermashup.com/wp-content/uploads/2010/01/graph.jpg" alt="graph" title="graph" width="582" height="300" /></p>
<h3>The Code</h3>
<p>Here&#8217;s how to setup  a simple chart. you need to include the jQuery framework as well as the highcharts.js file and excanvas.js file for IE users which you&#8217;ll get in the download from Highcharts. once you&#8217;ve got that setup simply paste this into your document head, and create a div with the id &#8216;graphDiv&#8217;, this is where the graph will render to. Note in the first few lines of setup code at the top of the script we specify this along with the chart type. In this case we&#8217;re using a bar chart. Below that we have the setup title parameter which is the main label for the graph along with the labels for the x and y axis. </p>
<p>You should be left with a graph as shown below.</p>
<p><img src="http://papermashup.com/wp-content/uploads/2010/01/fruit.png" alt="HighCharts Fruit Chart" title="HighCharts Fruit Chart" width="582" height="282"/></p>
<pre class="brush: jscript;">

   $(document).ready(function() {
      var chart1 = new Highcharts.Chart({
         chart: {
            renderTo: 'graphDiv',
            defaultSeriesType: 'bar'
         },
         title: {
            text: 'Fruit Consumption'
         },
         xAxis: {
            categories: ['Apples', 'Bananas', 'Oranges']
         },
         yAxis: {
            title: {
               text: 'Fruit eaten'
            }
         },
         series: [{
            name: 'Anne',
            data: [1, 0, 4]
         }, {
            name: 'Martin',
            data: [5, 7, 3]
         }]
      });
   });
</pre>
<blockquote><p>NOTE: the demo below is not of the code above. If you want to play around with the code for the demo you can simply copy the source from your web browser whilst viewing the demo</p></blockquote>
<p><a href="http://papermashup.com/demos/highcharts/"><img src="http://papermashup.com/wp-content/uploads/2009/01/demo.png" alt="demo" title="demo" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://papermashup.com/using-highcharts-javascript-library/feed/</wfw:commentRss>
		<slash:comments>28</slash:comments>
		</item>
		<item>
		<title>JavaScript link tracking with Google Analytics</title>
		<link>http://papermashup.com/javascript-link-tracking-with-google-analytics/</link>
		<comments>http://papermashup.com/javascript-link-tracking-with-google-analytics/#comments</comments>
		<pubDate>Sat, 12 Dec 2009 13:29:13 +0000</pubDate>
		<dc:creator>Ashley</dc:creator>
				<category><![CDATA[API's]]></category>
		<category><![CDATA[Analytics]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[MooTools]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[Web Tools]]></category>
		<category><![CDATA[headline]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[Google]]></category>
		<category><![CDATA[Search]]></category>

		<guid isPermaLink="false">http://papermashup.com/?p=1383</guid>
		<description><![CDATA[Google Analytics is great to tracking your site traffic. I started out using Statcounter.com to track my site visits, but over the years i&#8217;ve wanted more information so I switched over to using Google Analytics. Google provides an excellent dashboard to monitor and dig into your sites traffic and drill down the information to see exactly what content on your site is popular. For advertising campaigns at MySpace we use a JavaScript technique to track specific clicks on content on a page, with the ability ...]]></description>
			<content:encoded><![CDATA[<p>Google Analytics is great to tracking your site traffic. I started out using <a href="http://Statcounter.com" name="statcounter - link">Statcounter.com</a> to track my site visits, but over the years i&#8217;ve wanted more information so I switched over to using Google Analytics. Google provides an excellent dashboard to monitor and dig into your sites traffic and drill down the information to see exactly what content on your site is popular. For advertising campaigns at MySpace we use a JavaScript technique to track specific clicks on content on a page, with the ability to label specific content using the &#8216;name&#8217; attribute. I&#8217;m providing the jQuery and Mootools code to implement this below. By using this technique when you view what content has been clicked in the analytics dashboard, and instead of seeing a bunch of long urls with various parameters in you can easily see a readable label as to what that link really is as shown below.</p>
<p><img src="http://papermashup.com/wp-content/uploads/2009/12/google-ana.png" alt="google-ana" title="google-ana" width="582" height="300" class="alignnone size-full wp-image-1389" /></p>
<h3>jQuery Version</h3>
<p>So below is a simple &#8216;click&#8217; function that basically gets the value of the name attribute from any link that we set on our page and sends it to the analytics code at the bottom of our document. </p>
<p>Here&#8217;s an example of a link:</p>
<pre class="brush: xml;">
&lt;a href=&amp;quot;http://www.google.co.uk/search?hl=en&amp;rlz=1G1GGLQ_ENGB314&amp;q=papermashup.com&amp;btnG=Search&amp;meta=&amp;aq=f&amp;oq=name=&amp;quot;papermashup search on Google;&amp;gt;Search Google&amp;lt;/&gt;
</pre>
<pre class="brush: jscript;">
$('document').ready(function () {
    $('a').click(function(){
        Pagetracker._trackPageview('/outgoing/' + $(this).attr('name'));
		});
	});
</pre>
<p>This is the analytics tracking code that will go just before the closing body tag on your page.</p>
<pre class="brush: jscript;">
&lt;script type=&quot;text/javascript&quot;&gt;
var gaJsHost = ((&quot;https:&quot; == document.location.protocol) ? &quot;https://ssl.&quot; : &quot;http://www.&quot;);
document.write(unescape(&quot;%3Cscript src='&quot; + gaJsHost + &quot;google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E&quot;));
&lt;/script&gt;
&lt;script type=&quot;text/javascript&quot;&gt;
try {
var pageTracker = _gat._getTracker(&quot;UA-6393355-53&quot;);
pageTracker._trackPageview('/outgoing');
} catch(err) {}&lt;/script&gt; 
</pre>
<h3>Mootools Version</h3>
<p>This is exactly that same technique as above with the jQuery version but replicated with Mootools.</p>
<pre class="brush: jscript;">

window.addEvent('load', function() {
		$$('a[name]').each(function(el) {
			el.addEvent('click',function() {
				var dd = '/outgoing/' + el.get('gaid');
				_gat._getTracker(&quot;UA-YOUR TRACKING ID&quot;)._trackPageview(dd);
			}.bind(this));
		});
});
</pre>
<p>So to sum up. To make your links easier to read in Google analytics add the name attribute to any link so when it&#8217;s clicked it will register with Google. </p>
]]></content:encoded>
			<wfw:commentRss>http://papermashup.com/javascript-link-tracking-with-google-analytics/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Key web development skills</title>
		<link>http://papermashup.com/key-web-development-skills/</link>
		<comments>http://papermashup.com/key-web-development-skills/#comments</comments>
		<pubDate>Tue, 03 Nov 2009 10:53:11 +0000</pubDate>
		<dc:creator>Ashley</dc:creator>
				<category><![CDATA[API's]]></category>
		<category><![CDATA[Blogging]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[Design]]></category>
		<category><![CDATA[Facebook]]></category>
		<category><![CDATA[Iphone]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[Mobile]]></category>
		<category><![CDATA[MooTools]]></category>
		<category><![CDATA[MySpace]]></category>
		<category><![CDATA[OAuth]]></category>
		<category><![CDATA[OpenID]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Social Media]]></category>
		<category><![CDATA[Social Networks]]></category>
		<category><![CDATA[Trends]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[Twitter]]></category>
		<category><![CDATA[Web Tools]]></category>
		<category><![CDATA[Widgets]]></category>
		<category><![CDATA[Wordpress]]></category>
		<category><![CDATA[headline]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[2009]]></category>
		<category><![CDATA[Advertising]]></category>
		<category><![CDATA[APIs]]></category>
		<category><![CDATA[Browsers]]></category>
		<category><![CDATA[Data Portability]]></category>
		<category><![CDATA[Del.icio.us]]></category>
		<category><![CDATA[Digg]]></category>
		<category><![CDATA[tools]]></category>
		<category><![CDATA[Web]]></category>

		<guid isPermaLink="false">http://papermashup.com/?p=1198</guid>
		<description><![CDATA[API Knowledge
A key tool for any budding web developer is API knowledge. It&#8217;s good to familiarise yourself with a variety of application interfaces. I started out using the Twitter REST API with PHP and CURL when twitter first launched the API to basically get a users tweets, pretty simple now I look back, but at the time it was the first time i&#8217;d done such a thing. As the development of social media continues this will increasingly open up opportunities to develop more and more ...]]></description>
			<content:encoded><![CDATA[<h3>API Knowledge</h3>
<p>A key tool for any budding web developer is API knowledge. It&#8217;s good to familiarise yourself with a variety of application interfaces. I started out using the Twitter REST API with PHP and CURL when twitter first launched the API to basically get a users tweets, pretty simple now I look back, but at the time it was the first time i&#8217;d done such a thing. As the development of social media continues this will increasingly open up opportunities to develop more and more applications that interact with one another and and make our daily chores more eventful.</p>
<p><img src="http://papermashup.com/wp-content/uploads/2009/11/api.jpg" alt="api" title="api" width="582" height="200" /></p>
<h3>Frameworks</h3>
<p>There&#8217;s generally a framework for just about every programming language out there. Whether you decide to learn the jQuery framework for JavaScript or Cake for PHP each one will help you succeed as a freelancer and further your career as a web developer. Frameworks in many respects take out the arduous repetitive tasks we face daily and give us more time to focus on developing cutting edge products or applications. </p>
<p><img src="http://papermashup.com/wp-content/uploads/2009/11/ruby.jpg" alt="ruby" title="ruby" width="582" height="200" /></p>
<h3>iPhone Applications</h3>
<p>Companies are Increasingly seeing the massive potential that there is in the mobile platform. Applications that are approved and make it into the Apple app store have the opportunity to be downloaded thousands of times and can potentially make a lot of money. Having a specific skill to be able to develop for this market can be very lucrative, especially in the current economic climate when companies are turning to social media to plug holes where they&#8217;re not seeing return on investment from other advertising sectors.</p>
<p><img src="http://papermashup.com/wp-content/uploads/2009/11/iphone.jpg" alt="iphone" title="iphone" width="582" height="200" /></p>
<h3>CMS Customisation</h3>
<p>A handy skill to have is a general knowledge of how to use content management systems. For example building themes and plugins for WordPress, or modules and components for Joomla and Mambo.  As a developer its important to have an idea of the structure of a variety of CMS&#8217;s. If you have a wordpress blog/site, that&#8217;s an easy way to familiarise yourself with the platform. Remember it&#8217;s always easier to learn something by immersing yourself in the technology.</p>
<p><img src="http://papermashup.com/wp-content/uploads/2009/11/wordpress.jpg" alt="wordpress" title="wordpress" width="582" height="200" /></p>
<h3>Online Payments</h3>
<p>Businesses are always going to need payment solutions online. Having the skills to take a site and integrate  paypal or google checkout will allow you to go far. We&#8217;re starting to see many 3rd party software companies setting up and selling software at more affordable prices, take <a href="http://www.panic.com/">Panic</a> for example. They are a relatively small company that develop a selection of web development software for the mac. Many new startups are settling for a product based revenue stream rather than making money purely through ads, revenue share, or partnership deals. This opens up the demand for skilled developers to be able to build payment solutions.</p>
<p><img src="http://papermashup.com/wp-content/uploads/2009/11/google-checkout.png" alt="google-checkout" title="google-checkout" width="582" height="200"/></p>
]]></content:encoded>
			<wfw:commentRss>http://papermashup.com/key-web-development-skills/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Steps to learning a new programming language</title>
		<link>http://papermashup.com/steps-to-learning-a-new-programming-language/</link>
		<comments>http://papermashup.com/steps-to-learning-a-new-programming-language/#comments</comments>
		<pubDate>Tue, 27 Oct 2009 08:55:11 +0000</pubDate>
		<dc:creator>Ashley</dc:creator>
				<category><![CDATA[API's]]></category>
		<category><![CDATA[Blogging]]></category>
		<category><![CDATA[Downloads]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[MooTools]]></category>
		<category><![CDATA[OAuth]]></category>
		<category><![CDATA[OpenID]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Social Media]]></category>
		<category><![CDATA[Trends]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[Web Tools]]></category>
		<category><![CDATA[Wordpress]]></category>
		<category><![CDATA[headline]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[Ajax]]></category>
		<category><![CDATA[APIs]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[learning]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[tools]]></category>
		<category><![CDATA[Web]]></category>

		<guid isPermaLink="false">http://papermashup.com/?p=1180</guid>
		<description><![CDATA[Learning a new programming language can be daunting to say the least. I&#8217;ve recently cracked it when it comes to jQuery. I wouldn&#8217;t say Im a pro by any stretch of the imagination but I can successfully build applications. It wasn&#8217;t an easy ride learning a new syntax, I&#8217;m going to run over a few tips and techniques that i found useful learning both jQuery and PHP.
Take Time To Learn
In order to get into your new programming language you need time and commitment to perfect ...]]></description>
			<content:encoded><![CDATA[<p>Learning a new programming language can be daunting to say the least. I&#8217;ve recently cracked it when it comes to jQuery. I wouldn&#8217;t say Im a pro by any stretch of the imagination but I can successfully build applications. It wasn&#8217;t an easy ride learning a new syntax, I&#8217;m going to run over a few tips and techniques that i found useful learning both jQuery and PHP.</p>
<h3>Take Time To Learn</h3>
<p>In order to get into your new programming language you need time and commitment to perfect your new skill. Take the time to spend a day learning rather than and hour here and an hour there, you&#8217;ll learn more this way. it took me about a week to get comfortable with jQuery. I use jQuery everyday so it was relatively easy to get to grips with as the learning process was continuous, however you need sleep so your brain can de-fragment everything you&#8217;ve learnt that day.</p>
<h3>Buy a selection of books</h3>
<p>The truth is you just can&#8217;t learn a programming language in 24hrs, some books purport to teach you the basics in 24hrs. I&#8217;ve never found these books useful. I&#8217;d recommend buying a selection of books for whichever language your learning and sit down and read the basics. You&#8217;ll find some books easier to read than others so pick your books carefully. Remember you won&#8217;t be able to learn everything from a book but it&#8217;s a great starting point to start to understand the logic.</p>
<h3>Collect tutorials and demos</h3>
<p>Start building up a folder of download demos that you can refer to and reverse engineer. I find this very useful, and still do it if i want a quick fix for a project. Reading tutorials on your specific language will also give you a better understanding. generally tutorials are short and sweet and give you all the info you need to know.</p>
<h3>Bug fixing</h3>
<p>It&#8217;s inevitable that your going to run into code errors. Don&#8217;t pull your hair out, we all go through it, work through the error and go back on yourself to find out what the problem was. If your building an application, don&#8217;t just code it all then test it. Test your code as you go along, then if you find an error you&#8217;ll quickly be able to identify the problem.</p>
]]></content:encoded>
			<wfw:commentRss>http://papermashup.com/steps-to-learning-a-new-programming-language/feed/</wfw:commentRss>
		<slash:comments>18</slash:comments>
		</item>
		<item>
		<title>Mootools Ajax Example</title>
		<link>http://papermashup.com/mootools-ajax-example/</link>
		<comments>http://papermashup.com/mootools-ajax-example/#comments</comments>
		<pubDate>Fri, 06 Feb 2009 12:15:59 +0000</pubDate>
		<dc:creator>Ashley</dc:creator>
				<category><![CDATA[Downloads]]></category>
		<category><![CDATA[MooTools]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[Ajax]]></category>
		<category><![CDATA[Javascript]]></category>

		<guid isPermaLink="false">http://papermashup.com/?p=373</guid>
		<description><![CDATA[
Here&#8217;s a quick example of an ajax request with Mootools. the code below is from sandmoose.com. However I have modified it to get the data using the twitter search api.
So the script contains 4 functions, the first function &#8216;initializeContainer&#8217; makes a new ajax request to our file, in this case &#8216;twitter.php&#8217;. The next function initialises the fade out effect, and tells the function that onComplete to trigger the function &#8216;updateContainer&#8217;. This function puts the data from our file &#8216;twitter.php&#8217; into the div with and id ...]]></description>
			<content:encoded><![CDATA[<p><img src="http://papermashup.com/wp-content/uploads/2009/02/mootools-ajax.gif" alt="mootools-ajax" title="mootools-ajax" width="529" height="140" class="alignnone size-full wp-image-387" /></p>
<p>Here&#8217;s a quick example of an ajax request with Mootools. the code below is from <a href="http://www.sandmoose.com/">sandmoose.com</a>. However I have modified it to get the data <a href="http://papermashup.com/using-the-twitter-search-api/">using the twitter search api</a>.</p>
<p>So the script contains 4 functions, the first function &#8216;initializeContainer&#8217; makes a new ajax request to our file, in this case &#8216;twitter.php&#8217;. The next function initialises the fade out effect, and tells the function that onComplete to trigger the function &#8216;updateContainer&#8217;. This function puts the data from our file &#8216;twitter.php&#8217; into the div with and id of contain, once this is done it triggers the function &#8216;fadeinContainer&#8217; which fades the contents of the div back in.</p>
<p>You need to include the mootools framework, here&#8217;s the Google hosted link:</p>
<pre>
<pre class="brush: jscript;">
&lt;script src=&quot;http://ajax.googleapis.com/ajax/libs/mootools/1.11/mootools-yui-compressed.js&quot; type=&quot;text/javascript&quot;&gt;&lt;!--mce:0--&gt;&lt;/script&gt;
</pre>
</pre>
<p>The Code:</p>
<pre>
<pre class="brush: jscript;">
function initializeContainer() {
	new Ajax('twitter.php', {update:'contain'}).request();
}

function ajaxRequest() {
	$('contain').effect('opacity',{duration:1000, fps:50, onComplete:updateContainer}).start(1,0);
};

function updateContainer() {
	new Ajax('twitter.php', {update:'contain', onComplete:fadeInContainer}).request();
}

function fadeInContainer() {
	$('contain').effect('opacity',{duration:1000, fps:50}).start(0,1);
}
</pre>
</pre>
<p>We need to initialise the function onload.</p>
<pre>
<pre class="brush: xml;">
&lt;body onLoad=&quot;initializeContainer()&quot;&gt;
</pre>
</pre>
<p><a href="http://papermashup.com/demos/mootools/Ajax-demo/ajax.html"><img title="demo" src="http://papermashup.com/wp-content/uploads/2009/01/demo.png" alt="demo" width="123" height="48" /></a><a href="http://papermashup.com/demos/mootools/Ajax-demo.zip"><img title="demo" src="http://papermashup.com/wp-content/uploads/2009/01/download.png" alt="demo" width="243" height="48" /></a> </p>
]]></content:encoded>
			<wfw:commentRss>http://papermashup.com/mootools-ajax-example/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Mootools auto font size adjustment</title>
		<link>http://papermashup.com/mootools-auto-font-size-adjustment/</link>
		<comments>http://papermashup.com/mootools-auto-font-size-adjustment/#comments</comments>
		<pubDate>Thu, 05 Feb 2009 08:40:07 +0000</pubDate>
		<dc:creator>Ashley</dc:creator>
				<category><![CDATA[Javascript]]></category>
		<category><![CDATA[MooTools]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[font size]]></category>

		<guid isPermaLink="false">http://papermashup.com/?p=350</guid>
		<description><![CDATA[
After browsing the vast space that is the internet, i stumbled upon a great piece of code that, depending on the number of words in a div automatically adjusts the font size. This could be really useful if you have a list of user feedback, that you want to jazz up.
So whats the code doing? Simply put. The code looks for the text within class &#8216;.text&#8217; then counts the number of words by exploding the text where there is a space, then its just a ...]]></description>
			<content:encoded><![CDATA[<p><img class="alignnone size-full wp-image-359" title="font-size-mootools" src="http://papermashup.com/wp-content/uploads/2009/02/font-size-mootools.gif" alt="font-size-mootools" width="529" height="92" /></p>
<p>After browsing the vast space that is the internet, i stumbled upon a great piece of code that, depending on the number of words in a div automatically adjusts the font size. This could be really useful if you have a list of user feedback, that you want to jazz up.</p>
<p><strong>So whats the code doing?</strong> Simply put. The code looks for the text within class &#8216;.text&#8217; then counts the number of words by exploding the text where there is a space, then its just a matter of putting in some if statements to adjust the font size using &#8216;el.setStyle&#8217;.</p>
<p>The Code:</p>
<pre>
<pre class="brush: jscript;">
window.addEvent('domready',function() {

    	$quote = $$('.text p:first-child');

        $each($quote,function(el) {

            var $numWords = el.get('text').split(' ').length;

                if (($numWords &gt;= 1) &amp;amp;amp;amp;amp;amp;&amp;amp;amp;amp;amp;amp; ($numWords &lt; 10)) {
                    el.setStyle('font-size','36px');
                }
                else if (($numWords &gt;= 10) &amp;amp;amp;amp;amp;amp;&amp;amp;amp;amp;amp;amp; ($numWords &lt; 20)) {
                    el.setStyle('font-size','32px');
                }
                else if (($numWords &gt;= 20) &amp;amp;amp;amp;amp;amp;&amp;amp;amp;amp;amp;amp; ($numWords &lt; 30)) {
                    el.setStyle('font-size','28px');
                }
                else if (($numWords &gt;= 30) &amp;amp;amp;amp;amp;amp;&amp;amp;amp;amp;amp;amp; ($numWords &lt; 40)) {
                    el.setStyle('font-size','24px');
                }
                else {
                    el.setStyle('font-size','20px');
                };

            });

    	});
</pre>
</pre>
<p>make sure that you include the mootools core js file.</p>
<p>The HTML:</p>
<pre>
<pre class="brush: xml;">
&lt;div class=&quot;text&quot;&gt;

Don't expect me to write anything interesting in here as this is really just a test! but you can check out the demo over at papermashup.com&lt;/div&gt;
</pre>
</pre>
<p><a href="http://papermashup.com/demos/mootools/font-resize.html"><img title="demo" src="http://papermashup.com/wp-content/uploads/2009/01/demo.png" alt="demo" width="123" height="48" /></a></p>
<p>Credit to <a href="http://css-tricks.com/">Chris Coyier over at CSS tricks</a> for this one. </p>
]]></content:encoded>
			<wfw:commentRss>http://papermashup.com/mootools-auto-font-size-adjustment/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
