Is there a way to have the function below run continuously while the mouse is held down? Currently, it only executes once per click. I am looking for a solution where the function keeps running as long as the mouse button is pressed down and stops when released.
$('#md').mousedown(function(e){
var pCords = e.pageY +e.pageY;
var max = $(document).height()+$(document).width();
var dg = 2*( pCords / max );
$('#div').css({ 'transform':'rotate('+dg+'deg) '});
});