InteractiveVolcano

An all-inclusive interactive and creative website providing tutorials for Javascript, Flash + jQuery.
So get started by delving into one of our tutorials today.

Privatize a Group of JavaScript Functions

It’s a common problem in JavaScript: to use private functions you define them as an object. Later, when interfacing this object with some JavaScript library, you discover that several of the namespaces overlap.

While there is certainly some debate as to how to write an unobtrusive set of JavaScript functions, the most elegant solution is as always very simple. Basically, you wrap the set of functions in a nameless function, and then call this function immediately. The syntax we are going to use works like this:

(function(argument) {
alert(argument);
}) (‘What you want to alert’);

If you’re unfamiliar with the notation, we are declaring a nameless function, then calling this function immediately with the final set of parentheses.

This is an excellent way to isolate any functions since everything is protected within the scope of the function. Now let’s strip it down a bit, … (more…)

Folding Side Nav with jQuery

With jQuery, coding side navigation with drawers that expand and collapse is a piece of cake.

Let’s start with some best-practices HTML/CSS navigation:

<ul id=”side-nav”>
<li class=”current”>
<a href=”/”>Products</a>
<ul>
<li>
<a href=”/apples”>Apples</a>
</li>

<li>
<a href=”/bananas”>Bananas</a>
</li>
</ul>
</li>

(more…)