Get new jQuery plugins just once a week
October 4, 2012
jGravity | jQuery plugin to add gravity to your website
jGravity is a jQuery plugin that adds gravity to either all or specified elements within a page. Using the plugin is as easy as
$(‘body’).jGravity(); which will use default settings to apply the gravity effect which is quite similar to how Google presented ‘Google Gravity’ in an earlier Google easter egg.
It has got the following settings :-
- target: Enter your target critera e.g. ‘div, p, span’, ‘h2’, ‘div#specificDiv’, or even ‘everything’ to target everything in the body. You can cover as many different targets as you like
- ignoreClass: Specify if you would like to use an ignore class, and then specify the class in quotations, e.g. ‘ignoreMe’
- weight: Enter any numerical value that is greater than 1 to decide the weight of elements (25 is default), you can also use the strings ‘heavy’ or ‘light’ to quickly test effects
- depth: Enter a numerical value that is greater than 1 to decide depth of gravity and how many elements it affects (1 is default). This is used to prevent targeting structural divs or other items which may break layout in jGravity
- drag: Decide if users can drag elements which have been effected by jGravity. Only ‘true’ and ‘false’ are acceptable.
Created by Craig Thomas
Add gravity to our website
Sign up for our weekly newsletter.