Posts Tagged ‘plugins’

Diagonal Accordion with jQuery

Friday, January 15th, 2010

diagonalAccordion is a jQuery plugin that allows for accordion functionality, but in a diagonal angle of your choice!

I forked Charles Marshall’s diagonal-accordion- plugin (on github) which allowed for a 45 degree angle accordion and hacked it to allow for any angle.

Use it like:

$("#someElement").diagonalaccordion({
acc_width:500,
acc_height:300,
bar_size:45,
speed:'slow',
accordion:'.accordion',
coverage:4,
diagAdjust: 3
});

Or even just:

$("#someElement").diagonalaccordion({
diagAdjust: 5
});

The only difference between using my plugin and his is the diagAdjust parameter. This parameter allows for incremental adjustments away from 45 degree angles. The bigger number you provide, the shallower the angle gets, until at number 11 it is effectively no angle. then after 11 it starts angling the other way.

Here’s the official demo for the original plugin. Like I said, mine works exactly the same way, it just has an extra param to use.

Exploring jQuery getScript, or “How I created the jQuery getScriptLite plugin”!

Thursday, December 17th, 2009

I set out to discover how the getScript function in jQuery works today. Here is what I found. This post sort of illustrates just how easy it is to dig into the jQuery source and really learn the library.

The first thing I did is hop over to github and pop open the source for the 1.3.2 release:

http://github.com/jquery/jquery/tree/1.3.2/src

Since getScript() is an AJAX function, I naturally clicked on “ajax.js”. On line 109 I found:

Oh wow! It’s just a convenience method! It doesn’t do anything magical at ALL. It simply calls $.get().

Now, I could have stopped there, but for fun, let’s go deeper. On line 93 I found the get() function:

Ok, so get() is really just a convenience method for ajax(), so let’s look for that. Line 25, the ajax() function:

Wait, that’s not the one! I don’t really know how this works, but that can’t be the one because it strips out the script tags. I find another one later on on line 170 that goes all the way to line 451. Way down on line 253 it seems to handle the actual script loading:

Aha! Clever. Creates a script tag and sets it’s source to the one we specified and then on line 278 appends it to the head of the document, I’m assuming at that point running the script because two lines later it returns out of the function:

So, there you have it! It would almost seem that you could do the same thing by:

In fact, that seems to work just fine. Hrm… Fork me on github and/or get the plugin!

Technorati

Saturday, February 9th, 2008

This is a test. Yes, I know, it looks like a brag blog, but it’s a test. In fact, don’t even read this post.

I signed up for google alerts on the words “chomperstomp“, “status bar calculator” and “christopher mcculloh” just out of curiosity. I’m trying to figure out how it works, so I specifically put those phrases in here to see if Google lets me know that someone (me) posted about those phrases.

So far I’ve been surprised by what I found:

1. The Status Bar Calculator has been downloaded at least 30,000 times (wha??? Crap. I had really, really better get working on v2.0…)

2. I’m in Technorati for my math posts on the ball rolling game (which have actually been my most successful posts to date in terms of reader interest, again, what???)

So, the entire point of this post (other than to test my Google alerts) is that I have to put this tag in my blog in order to claim it as my own:

Technorati Profile

Done.