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

Popular posts from this blog

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

html - How to style widget with post count different than without post count -

url rewriting - How to redirect a http POST with urlrewritefilter -