Making a jQuery plugin work on all objects

Posted by Jon Winstanley on Stack Overflow See other posts from Stack Overflow or by Jon Winstanley
Published on 2010-04-06T14:51:32Z Indexed on 2010/04/06 14:53 UTC
Read the original article Hit count: 237

Filed under:
|
|

I am using the jQuery physics plugin for a pet project I am working on.

The plugin enables the moving of DOM objects in realistic ways using velocity, gravity, wind etc.

However I want to use the plugin to calculate where objects are to be placed inside a canvas element, not DOM objects.

How do I change the plugin script functions to work on any object with 'top' and 'left' properties rather than only working with DOM objects:

Currently the script functions look like this:

jQuery.fn.funname = function() {

    return this;

};

© Stack Overflow or respective owner

Related posts about jQuery

Related posts about plugins