javascript - binding predefined functions to Jquery events -
i have working script apply transformations svg image draggable. script works when use attributes of html element.
<g id="all" onmousedown="startmove(evt)" onmousemove="moveit(evt)" onmouseup="endmove(evt)"> however bind events jquery below , wonder going wrong code below
$('svg > g').mousedown(startmove(evt)); $('svg > g').mousemove(moveit(evt)); $('svg > g').mouseup(endmove(evt));
try this:
$('svg > g').mousedown(function(evt){ //do stuff }); or even
$('svg > g').mousedown(startmove); function startmove(evt){ //do stuff } startmove references actual function, while startmove() uses it's return value.
Comments
Post a Comment