Skip to content

Instantly share code, notes, and snippets.

@mmv
Created May 27, 2013 14:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mmv/5657302 to your computer and use it in GitHub Desktop.
Save mmv/5657302 to your computer and use it in GitHub Desktop.
// Stamp a message anywhere on your web page
jQuery(document).ready(function($) {
function genRandInt(min, max) {
return Math.floor(Math.random() * (max - min + 1)) + min;
}
$(document).on("click", function(e) {
if (e.target.tagName == "A") { return; }
else {
$('<div style="font-size: xx-large; font-weight: bold;">Charts be here!</div>')
.css('transform', 'rotate(' +
genRandInt(-45,45) + 'deg)')
.css('color','hsl(' + genRandInt(0,359) + ',100%,50%)')
.css('position','absolute')
.css({left: e.pageX, top: e.pageY})
.appendTo('body');
}
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment