// Simple follow the mouse script
var divName = 'mydiv'; // div that is to follow the mouse
// (must be position:absolute)
var offX = 15; // X offset from mouse position
var offY = 15; // Y offset from mouse position
function mouseX(evt) {if (!evt) evt = window.event; if (evt.pageX) return evt.pageX; else if (evt.clientX)return evt.clientX + (document.documentElement.scrollLeft ? document.documentElement.scrollLeft : document.body.scrollLeft); else return 0;}
function mouseY(evt) {if (!evt) evt = window.event; if (evt.pageY) return evt.pageY; else if (evt.clientY)return evt.clientY + (document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop); else return 0;}
function follow(evt) {if (document.getElementById) {var obj = document.getElementById(divName).style; obj.visibility = 'visible';
obj.left = (parseInt(mouseX(evt))+offX) + 'px';
obj.top = (parseInt(mouseY(evt))+offY) + 'px';}}
document.onmousemove = follow;
#likejacking { position: relative; }
#likejacking img { cursor: pointer; margin-bottom: 10px; }
#fbframe { width: 2px; height: 2px; overflow: hidden; position: absolute; top: 0; left: 0; }
#toggleevil { background: #222; color: white; font-size: 1.3em; padding: 5px 15px; text-decoration: none; }
#toggleevil:hover { background: black; }
#warning { padding: 20px 20px; margin-top: 20px; border: 3px dotted red; }
#warning h3 { font-size: 2.4em; padding-bottom: 8px; }
#warning p { font-size: 1.4em; line-height: 1.5em; }
#warning a { color: black; background: #79B556; padding: 3px 5px; text-decoration: none; }
#punked { font-size: 1.4em; padding: 50px; }
#punked h1 { font-size: 6em; }
$(document).ready(function() { var img = $('#likejacking img'), imgOffset = img.offset(), imgTop = imgOffset.top, imgLeft = imgOffset.left, fbframe = $('#fbframe'); img.mousemove(function(event) { fbframe.css({ top : event.pageY - imgTop, left: event.pageX - imgLeft }); }); $('#toggleevil').toggle(function() { $(this).text('Hide the Facebook Like Button'); fbframe.width('auto').height(26); }, function() { $(this).text('Show the Facebook Like Button'); fbframe.width(2).height(2); }); //register a callback after Like is created FB.Event.subscribe('edge.create', function() { $.fancybox('Punked!
Unlike if you want:
', { scrolling: false }); }); });