jsfiddle demo
This is on the body , but you can have it in other elements, of course. In this example, html and body are at 100% height and different background-color , so you will notice when dragging the body down. The mouse moves more than 200px and the page reloads.
var mouseY = 0; var startMouseY = 0; $('body').on('mousedown', function (ev) { mouseY = ev.pageY; startMouseY = mouseY; $(document).mousemove(function (e) { if (e.pageY > mouseY) { var d = e.pageY - startMouseY; console.log("d: " + d); if (d >= 200) location.reload(); $('body').css('margin-top', d/4 + 'px'); } else $(document).unbind("mousemove"); }); }); $('body').on('mouseup', function () { $('body').css('margin-top', '0px'); $(document).unbind("mousemove"); }); $('body').on('mouseleave', function () { $('body').css('margin-top', '0px'); $(document).unbind("mousemove"); });
source share