jQuery Plugin To Create Configurable Shake Effect - Shake.js

File Size: 4.09 KB
Views Total: 2768
Last Update:
Publish Date:
Official Website: Go to website
License: MIT
   
jQuery Plugin To Create Configurable Shake Effect - Shake.js

Shake.js is a lightweight jQuery plugin for horizontally or vertically shaking any element multiple times by using CSS position property and jQuery animate method. Without the need of jQuery UI. Great for important HTML elements on the webpage to grab your user's attention.

How to use it:

1. Link to JQuery library and the jQuery Shake.js plugin as this:

<script src="//code.jquery.com/jquery.min.js"></script>
<script src="jquery.shake.js"></script>

2. Call the function shake() on the DOM element you want to shake.

$('#el').shake();

3. Specify the number of shakes.

$('#el').shake({
  count: 3
});

4. Specify the relative distance of each shake.

$('#el').shake({
  distance: 20
});

5. Change the default animation duration.

$('#el').shake({
  duration: 800
});

6. Shake the element vertically.

$('#el').shake({
  vertical: true
});

7. The callback function that will be fired when shakes complete.

$('#el').shake({
  complete: null
});

This awesome jQuery plugin is developed by sujeet-kumar. For more Advanced Usages, please check the demo page or visit the official website.