Monday, February 4th, 2008

Low Pro for jQuery

Category: JavaScript, jQuery, Prototype

Dan Webb has ported Low Pro to jQuery and along the way discusses differences between Prototype and jQuery:

The one big reason was that, while jQuery was super simple and concise when working on smaller projects, it offered no help in structuring larger applications. All you get in jQuery, aside from Ajax methods and a handful of utilities, is the ability to select nodes then doing something with them. On the other hand Prototype is much rounder in scope. It generally plumps out JavaScript as a language adding lots of useful methods to built-ins, a host of functional programming tools and recently a full Class-based OO system with inheritance and the whole shebang which has formed the back bone of Low Pro’s behavior classes.

Let’s not get into that debate though, instead, lets just look at the port.

How do you use it?

Create a class


  1. Draggable = $.klass({
  2.   initialize: function(options) { },
  3.   onmousedown: function() {}
  4. });
  6. GhostedDraggable = $.klass(Draggable, {
  7.   onmousedown: function($super) {
  8.     // do extra stuff here then call original method...
  9.     $super();
  10.   }
  11. });

Attach behaviour


  1. $('div.product').attach(GhostedDraggable, { anOption: thing });

Also, if you are using livequery jLow (I had to use it Dan!) will play nicely and work as the DOM changes too!

Posted by Dion Almaer at 7:42 am

3.6 rating from 21 votes


Comments feed TrackBack URI

Don’t get me wrong. I’m not trying to spark anymore pointless debate on which library is best at all. I like them both and I think that jQuery’s descision to be tight in scope is one of it’s strengths. I was just commenting on why I though it was worth porting Low Pro to jQuery and where it might fit in the jQuery landscape.

Comment by danwrong — February 4, 2008

I love it. I’ve always wanted this in JQuery. I think as an add-on, it’s great.

Comment by Liming — February 4, 2008

One idea is that you can add functionality and hooks into plugins and jQuery objects instead of leaving it up to the plugin author to create those hooks, or creating your own plugin.

Comment by Marc — February 4, 2008

Leave a comment

You must be logged in to post a comment.