How would I make it so I can mousedown on the body on my page, then drag the page up or down, like you can in a PDF?
Basically I want to be able to drag the whole page u
Variation of Francesco's answer that includes scrolling along the X-axis:
$(function ()
{
var gesturesX = 0
, gesturesY = 0
, startX = 0
, startY = 0
, isMouseDown = false
$(document.body).mousemove(function (e)
{
gesturesX = parseInt(e.pageX, 10)
gesturesY = parseInt(e.pageY, 10)
if (isMouseDown)
{
window.scrollBy(startX - gesturesX, startY - gesturesY)
return false
}
}
)
$(document.body).mousedown(function ()
{
startX = gesturesX
startY = gesturesY
isMouseDown = true
return false
}
)
$(document.body).mouseup(function ()
{
isMouseDown = false
return false
}
)
}
)