views:

55

answers:

1

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 object.

How do I change the plugin script to work for ANY object with 'top' and 'left' properties rather than only working with DOM objects found with a jQuery selector?

Currently the script functions look like this:

jQuery.fn.funname = function() {
    return this;
};
A: 
// line 172 jquery.physics.js
if (!params.position) this.position = new $.Vector(parseFloat($(this).css('left')),parseFloat($(this).css('top')));
Elzo Valugi