jQuery Splatter Plugin
February 9th, 2011
Splatter is a jQuery plugin which applies a random position, size, and color to elements on a page. The most basic implementation adds randomly colored and positioned asterisks to the element:

To see some working examples, check out the demo page.
Basic usage.
Add these scripts in the head element of your page:
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.5/jquery.min.js" type="text/javascript" charset="utf-8"></script>
<script src="jquery.splatter.js" type="text/javascript" charset="utf-8"></script>
Invoke the plugin, specifying configuration options as needed. For example, pass an array of splats if you’d like to use words rather than asterisks:
$('#word_splatter').splatter({
min_font_size: 20,
max_font_size: 50,
splats: ["Lorem", "Ipsum", "Dolor", "Sit", "Amet", "Consectetur", "Adipisicing", "Elit", "Sed", "Do", "Eiusmod", "Tempor", "Incididunt", "Ut", "Labore", "Et", "Dolore", "Magna", "Aliqua", "Ut", "Enim", "Ad", "Minim", "Veniam", "Quis", "Nostrud", "Exercitation", "Ullamco", "Laboris", "Nisi", "Ut", "Aliquip", "Ex", "Ea", "Commodo", "Consequat"]
});
Which creates:

Configuration options.
Splatter has lots of configuration options but most of them are pretty simple and none of them are required:
$('#splatter_box').splatter({
custom_attributes: [], // specify custom attributes to add to splats which can be used to store data
colors: [], // specify the colors to be randomly applied to the splats
splats: [], // specify strings to be used as splats – defaults to *
hover_on: function() {}, // add a custom function to be called when hovering on a splat
hover_off: function() {}, // add a custom function to be called when hovering off a splat
splat_count: 20, // number of splats that will be drawn
min_font_size: 20, // minimum font size for splats
max_font_size: 300, // maximum font size for splats
height: $(window).height(), // height of splatter
width: $(window).width() // width of splatter
});
Most of these should be fairly obvious but let’s go into a bit more detail on how to use custom attributes. Custom attributes allow you to apply data attributes with random values to each splat. They are specified as an array of objects:
$('#splatter_box').splatter({
custom_attributes: [
{ name: "data-hover_color", values: ['#f68a00', '#069', '#a70'] },
{ name: "data-slide_position", values: ['20', '50', '100'] }
]
});
Each custom attribute object should have two keys: a name and values. The name will be used as the attribute’s name. The values key takes an array of possible values. The actual value for any given custom attribute is randomly selected from the values array.
So the the above example might create splats that look like:
*
*
Often custom attributes work in conjunction with custom hover events, allowing you to use jQuery to fetch these custom values and do something interesting (e.g. fade in a different color, animate a splats position, or make a splat randomly rotate). For example, let’s create 100 splats in shades of gray that fade into random colors on hover:
$('#animated_colors').splatter({
width: 700,
height: 250,
splat_count: 100,
colors: ['#ccc', '#e0e0e0', '#333', '#666', '#999'],
custom_attributes: [
{ name: "data-hover_color", values: ['#f68a00', '#069', '#a70', '#090', '#ff1493', '#0066CC', '#ff1493', '#F0E356'] }
],
hover_on: function(splat) {
var original_color = splat.css('color');
var hover_color = splat.attr('data-hover_color')
splat.css('color', hover_color).attr('data-hover_color', original_color);
},
hover_off: function(splat) {
var original_color = splat.css('color');
var hover_color = splat.attr('data-hover_color');
splat.css('color', hover_color).attr('data-hover_color', original_color);
}
});
And add some CSS3 to handle the color transitions:
.splatter_box .splat {
transition: color 0.5s linear;
-moz-transition: color 0.5s linear;
-o-transition: color 0.5s linear;
-webkit-transition: color 0.5s linear;
cursor: pointer;
}
Which will create something like:

If you need additional help understanding the various configuration options, check out the live demos as well as the unit tests.
[...] This post was mentioned on Twitter by Manuel Molossi, Alcides Ramos and Kiran Ruth R, Codrops. Codrops said: Cory Schires – jQuery Splatter Plugin – http://goo.gl/ai1El [...]
February 11th, 2011
Tweets that mention Cory Schires - jQuery Splatter Plugin -- Topsy.com[...] Link: http://coryschires.com/jquery-splatter-plugin/ [...]
February 12th, 2011
Splatter, un plugin jQuery che posiziona elementi random! | sastgroup.comThis is the coolest jQuery plugin of 2011. Well done, thanks for the unit test links as well, that is a really nice touch.
Reply
February 14th, 2011
MontanaNote, the last sample “rotate” only works in safari or a mobile safari browser.
Reply
Yeah. Should probably have mentioned that. The same may also be true for examples with color transitions depending on your browser.
February 23rd, 2011 Cory Schires
February 23rd, 2011
Derrick[...] [...]
March 16th, 2011
30 Fantastic New jQuery Plugins-Speckyboy Design Magazine[...] jQuery Splatter Plugin [...]
March 17th, 2011
30 Fantastic New jQuery Plugins | Preukson[...] jQuery Splatter Plugin [...]
March 17th, 2011
Quelques plugs jquery « SpagMedia[...] configuration options, but the most of them are pretty simple and none of them are required. jQuery Splatter Plugin | [...]
March 22nd, 2011
30 Fantastic New jQuery Plugins « Dragon Blog[...] jQuery Splatter plugin to avoid collision/overlap jQuery Splatter by Cory Schires I was looking for something that would allow me to scatter elements (divs w/ background-images) [...]
May 25th, 2011
Modifying jQuery Splatter plugin to avoid collision/overlap - DesignersTalk[...] jQuery Splatter Plugin [...]
January 18th, 2012
The best 120+ Jquery plugins from around the internet[...] jQuery的飞溅插件 [...]
February 6th, 2012
35个新鲜免费易于使用的jQuery插件 | Jackchen Design 1984[...] jQuery的飞溅插件 [...]
February 7th, 2012
35个新鲜免费易于使用的jQuery插件 - BearKind[...] jQuery的飞溅插件 [...]
February 7th, 2012
35个新鲜免费易于使用的jQuery插件 | Goldenfish[...] jQuery Splatter Plugin [...]
February 8th, 2012
35 cool JQuery plugins | Ning Ma blogNice work. I’m viewing it on my Android phone so can’t really test it properly. Will give it a full page testing when I get home.
Reply
April 12th, 2012
Helen Neely