<?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>Webdevelopment at huuah.com &#187; javascript</title>
	<atom:link href="http://huuah.com/tag/javascript/feed/" rel="self" type="application/rss+xml" />
	<link>http://huuah.com</link>
	<description>webdevelopment, cms, php, javascript etc</description>
	<lastBuildDate>Sat, 04 Sep 2010 22:55:27 +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>Basic jQuery div rotator</title>
		<link>http://huuah.com/basic-jquery-div-rotator/</link>
		<comments>http://huuah.com/basic-jquery-div-rotator/#comments</comments>
		<pubDate>Fri, 26 Mar 2010 21:54:24 +0000</pubDate>
		<dc:creator>js - huuah</dc:creator>
				<category><![CDATA[development]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[css]]></category>
		<category><![CDATA[javascript]]></category>

		<guid isPermaLink="false">http://huuah.com/?p=536</guid>
		<description><![CDATA[<p>So &#8211; how do one make a simple rotations function in jquery? There are many ways to do this, so I will just demonstrate one of them here:</p>
<a name="Example+code+for+the+jQuery+DIV+rotator%3A"></a>Example code for the jQuery DIV rotator:
<pre class="brush: xml;">
&#60;div class=&#34;&#34;&#62;
&#60;div class=&#34;focusitem active&#34;&#62;Item 1&#60;/div&#62;
&#60;div class=&#34;focusitem notactive&#34;&#62;Item 2&#60;/div&#62;
&#60;div</pre><p>&#8230;</p>]]></description>
			<content:encoded><![CDATA[<p>So &#8211; how do one make a simple rotations function in jquery? There are many ways to do this, so I will just demonstrate one of them here:</p>
<a name="Example+code+for+the+jQuery+DIV+rotator%3A"></a><h1>Example code for the jQuery DIV rotator:</h1>
<pre class="brush: xml;">
&lt;div class=&quot;&quot;&gt;
&lt;div class=&quot;focusitem active&quot;&gt;Item 1&lt;/div&gt;
&lt;div class=&quot;focusitem notactive&quot;&gt;Item 2&lt;/div&gt;
&lt;div class=&quot;focusitem notactive&quot;&gt;Item 3&lt;/div&gt;
&lt;div class=&quot;focusitem notactive&quot;&gt;Item 4&lt;/div&gt;
&lt;/div&gt;
</pre>
<p>And this will output 4 divs as shown here:</p>
<div class="focusitem&nbsp;active">Item 1</div>
<div class="focusitem&nbsp;notactive">Item 2</div>
<div class="focusitem&nbsp;notactive">Item 3</div>
<div class="focusitem&nbsp;notactive">Item 4</div>
<p>Nothing exciting about this, really. So &#8211; lets add the forward and backward button for the shifting of visible divs.</p>
<a name="Make+the+items+rotate"></a><h1>Make the items rotate</h1>
<pre class="brush: xml;">
&lt;div class=&quot;goleft&quot;&gt;Go Left&lt;/div&gt;

&lt;div class=&quot;&quot;&gt;
&lt;div class=&quot;focusitem active&quot;&gt;Item 1&lt;/div&gt;
&lt;div class=&quot;focusitem notactive&quot;&gt;Item 2&lt;/div&gt;
&lt;div class=&quot;focusitem notactive&quot;&gt;Item 3&lt;/div&gt;
&lt;div class=&quot;focusitem notactive&quot;&gt;Item 4&lt;/div&gt;
&lt;/div&gt;

&lt;div class=&quot;goright&quot;&gt;Go Right&lt;/div&gt;
</pre>
<p>There is now added 2 buttons/divs/textsfield &#8211; a left one and a right one. All we have to do, is make the buttons change which div is visible. The easy way to do this, is by changing the class name of the div and with CSS control the visibility and format.</p>
<p>To register a click event on the left and right buttons, we have to use the click()-function in jQuery.</p>
<p>That can look like this:</p>
<p>Javascript:</p>
<pre class="brush: jscript;">
     // trigger the mouse click even
     $(&quot;.goleft&quot;).click( function(e) {
        // get the current active element
        var $active = $(&quot;.active&quot;);
        // get the previous element or, if no previous then get the last item in the focusitem-class.
        var $next = $active.prev().length ? $active.prev() : $(&quot;.focusitem:last&quot;);

        // set the visibility of the active and notactive classes.
        $active.removeClass('active');
        $active.addClass('notactive');
        $next.addClass('active');
        $next.removeClass('notactive');
    });
</pre>
<p>CSS:</p>
<pre class="brush: css;">
&lt;div class=&quot;focusitem active&quot;&gt;Item 1&lt;/div&gt;
&lt;div class=&quot;focusitem notactive&quot;&gt;Item 2&lt;/div&gt;
&lt;div class=&quot;focusitem notactive&quot;&gt;Item 3&lt;/div&gt;
&lt;div class=&quot;focusitem notactive&quot;&gt;Item 4&lt;/div&gt;
</pre>
<a name="Result%3A"></a><h1>Result:</h1>
<div class="goleft">Go Left</div>
<div class="">
<div class="focusitem active">Item 1</div>
<div class="focusitem notactive">Item 2</div>
<div class="focusitem notactive">Item 3</div>
<div class="focusitem notactive">Item 4</div>
</div>
<div class="goright">Go Right</div>
<div class="clear"></div>
<a name="How+it+works"></a><h1>How it works</h1>
<p>The jQuery rotation code gets activated as soon as a user clicks the buttons. It find the active element, and the next or previous element corresponding to which buttons is activated and the toggles the active and notactive classes on the focusitems.</p>
<p>Complete jQuery code:</p>
<pre class="brush: jscript;">
(document).ready(function() {

    $(&quot;.goleft&quot;).click( function(e) {
        var $active = $(&quot;.active&quot;);
        var $next = $active.prev().length ? $active.prev() : $(&quot;.focusitem:last&quot;);

        $active.removeClass('active');
        $active.addClass('notactive');
        $next.addClass('active');
        $next.removeClass('notactive');
    });

    $(&quot;.goright&quot;).click( function(e) {
        var $active = $(&quot;.active&quot;);
        var $next = $active.next().length ? $active.next() : $(&quot;.focusitem:first&quot;);

        $active.removeClass('active');
        $active.addClass('notactive');
        $next.addClass('active');
        $next.removeClass('notactive');
    });

});
</pre>
<p>Complete CSS for the above example:</p>
<pre class="brush: css;">
.active {
    display: block;
    width: 100px;
    float: left;
}
.notactive {
    display: none;
}

.goleft, .goright {
    cursor: pointer;
    width: 100px;
    float: left;
    border: 1px solid;
}
</pre>
<a name="Now+what%3F"></a><h1>Now what?</h1>
<p>For more fancy display that my example shows, try putting some images ind the focusitem and make some nice arrows for the go left and right buttons. The usability of the rotator will improve a lot, by making some easy layout adjustments. </p>
<p>Obvious expansions for this kind of rotator would be a more fancy shift/glide between active divs or perhaps loading each element with Ajax, but this is intensionally not covered in this post. </p>
]]></content:encoded>
			<wfw:commentRss>http://huuah.com/basic-jquery-div-rotator/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Including Javascript or CSS in your TYPO3 template</title>
		<link>http://huuah.com/including-javascript-or-css-in-your-typo3-template/</link>
		<comments>http://huuah.com/including-javascript-or-css-in-your-typo3-template/#comments</comments>
		<pubDate>Thu, 08 Oct 2009 20:46:40 +0000</pubDate>
		<dc:creator>js - huuah</dc:creator>
				<category><![CDATA[TYPO3]]></category>
		<category><![CDATA[howto]]></category>
		<category><![CDATA[css]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[template]]></category>

		<guid isPermaLink="false">http://huuah.com/?p=409</guid>
		<description><![CDATA[<p>Have you ever had the need for inserting extra stylesheet or javascript files in your TYPO3 template? I am used to having a TemplaVoila setup, which has the nice feature of mapping part of the header as part of the template, but this is not really that flexible when using&#8230;</p>]]></description>
			<content:encoded><![CDATA[<p>Have you ever had the need for inserting extra stylesheet or javascript files in your TYPO3 template? I am used to having a TemplaVoila setup, which has the nice feature of mapping part of the header as part of the template, but this is not really that flexible when using extension template and etc.</p>
<p>An easy way of controlling this, is to setup the javascript and css files from the template configuration. There are some different ways of doing this and I will demonstrate two of them here.</p>
<p>The template configuration examples should be self-explainable, so I will not comment them futher:</p>
<p><strong>Javascript option 1 &#8211; headerData:</strong></p>
<pre class="brush: plain;">
page.headerData.230 = TEXT
page.headerData.230.value = &lt;script type=&quot;text/javascript&quot; src=&quot;/fileadmin/myjavascript.js&quot;&gt;&lt;/script&gt;
</pre>
<p><strong>Javascript option 2 &#8211; includeJS:</strong></p>
<pre class="brush: plain;">
page.includeJS {
  file1 = fileadmin/myjavascript.js
  file1.type = application/x-javascript
  file2 = fileadmin/myjavascript2.js
}
</pre>
<p><strong>CSS option 1 &#8211; headerData</strong></p>
<pre class="brush: plain;">
page.headerData.231 = TEXT
page.headerData.231.value = &lt;link rel=&quot;stylesheet&quot; type=&quot;text/css&quot; href=&quot;/fileadmin/stylesheet.css&quot; /&gt;
</pre>
<p><strong>CSS option 2 &#8211; includeCSS</strong></p>
<pre class="brush: plain;">
page.includeCSS {
  file1 = fileadmin/stylesheet.css
}
</pre>
<p><strong>CSS option 3 &#8211; page.stylesheet</strong></p>
<pre class="brush: plain;">
page.stylesheet = fileadmin/stylesheet.css
</pre>
<p>Hope this tip can be helpful. Please notice that the CSS option 3 only enables you to <strong>set 1 stylesheet</strong>, where the other examples support multiple files.</p>
]]></content:encoded>
			<wfw:commentRss>http://huuah.com/including-javascript-or-css-in-your-typo3-template/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>
