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

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

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

javascript - storing input from prompt in array and displaying the array -