About

The Plugin

jRumble is a jQuery plugin that rumbles, vibrates, shakes, and rotates any element you choose. It's great to use as a hover effect or a way to direct attention to an element. You can control the X, Y, and rotation range, the speed, and event trigger for the rumble.

Note: jRumble is currently a little buggy in Internet Explorer. A rumbleSpeed of 0 seems to break the rumble. Also, there is currently no rotation on any objects in IE.

Please read this before using jRumble. Flashing and flickering objects on the web can be dangerous. Please use this plugin responsibly.

The Author

My name is Jack Rugile. I am a 23 year old web and graphic designer living in Colorado. jQuery is super fun, so I use it all the time. When I am not designing, I love playing music and watching movies. Feel free to follow me on Twitter: @jackrugile.

Usage

Include jQuery and jRumble

Include jQuery and jRumble just before your closing body tag. Make sure the path to your files is correct. I recommend including through Google Libraries API.


<script type="text/javascript" src="js/jquery.js"></script>
<script type="text/javascript" src="js/jrumble.1.0.js"></script>
			

Reference jRumble on a Selector

You can do this in a script tag within your HTML or through an external JavasScript file.


$(document).ready(function(){
	$('#my-rumble-div').jrumble();
});
			

Demos

Ranges

rangeX: 2
rangeY: 2
rangeRot: 1

1

rangeX: 10
rangeY: 10
rangeRot: 4

2

rangeX: 4
rangeY: 0
rangeRot: 0

3

rangeX: 0
rangeY: 0
rangeRot: 5

4
View Source

$('#demo1').jrumble({
	rangeX: 2,
	rangeY: 2,
	rangeRot: 1
});

$('#demo2').jrumble({
	rangeX: 10,
	rangeY: 10,
	rangeRot: 4
});

$('#demo3').jrumble({
	rangeX: 4,
	rangeY: 0,
	rangeRot: 0
});

$('#demo4').jrumble({
	rangeX: 0,
	rangeY: 0,
	rangeRot: 5
});
				

Rumble Speeds

0

5

50

6

100

7

200

8
View Source

$('#demo5').jrumble({
	rumbleSpeed: 0
});

$('#demo6').jrumble({
	rumbleSpeed: 50
});

$('#demo7').jrumble({
	rumbleSpeed: 100
});

$('#demo8').jrumble({
	rumbleSpeed: 200
});
				

Event Types

Hover

9

Click

10

Mousedown

11

Constant

12
View Source

$('#demo9').jrumble({
	rumbleEvent: 'hover'
});

$('#demo10').jrumble({
	rumbleEvent: 'click'
});

$('#demo11').jrumble({
	rumbleEvent: 'mousedown'
});

$('#demo12').jrumble({
	rumbleEvent: 'constant'
});
				

Absolute Positioning (Fixed positioning uses the same concept)

posX: 'left'
posY: 'top'

13

posX: 'right'
posY: 'top'

14

posX: 'left'
posY: 'bottom'

15

posX: 'right'
posY: 'bottom'

16
View Source

$('#demo13').jrumble({
	posX: 'left',
	posY: 'top'
});

$('#demo14').jrumble({
	posX: 'right',
	posY: 'top'
});

$('#demo15').jrumble({
	posX: 'left',
	posY: 'bottom'
});

$('#demo16').jrumble({
	posX: 'right',
	posY: 'bottom'
});
				

Documentation

Options/Defaults

Option Default Description
rangeX 2 Set the horizontal rumble range (pixels)
rangeY 2 Set the vertical rumble range (pixels)
rangeRot 1 Set the rotation range (degrees)
rumbleSpeed 10 Set the speed/frequency in milliseconds of the rumble (lower number = faster)
rumbleEvent 'hover' Set the event that triggers the rumble ('hover', 'click', 'mousedown', 'constant')
posX 'left' If using jRumble on a fixed or absolute positioned element, choose 'left' or 'right' to match your CSS
posY 'top' If using jRumble on a fixed or absolute positioned element, choose 'top' or 'bottom' to match your CSS

Known Issues

Changelog

v1.1 - March 30, 2011
Fixed error that occured each time jRumble was triggered - Thanks to tornography for finding this
Hover bug fixed with release of jQuery 1.5.2 (1.5.1 was leaving hover state in the "on" position)

v1.0 - March 30, 2011
jRumble Initial Release

License


MIT License
-----------------------------------------------------------------------------
Copyright (c) 2011 Jack Rugile, http://jackrugile.com

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
			

Contact

Discussion

Glad you liked it. Would you like to share?

Sharing this page …

Thanks! Close

Add New Comment

Optional: Login below.

Showing 36 comments

Sort by   Subscribe by email   Subscribe by RSS
blog comments powered by Disqus
Site Meter