javascript - It is possible to code `if(($(document).onmouseup) && (value_ == 1))`? -


yesterday asked question. fiddle

my problem is, values passing function in every mouse event dragging , resizeable not correcty working.

so write

var value_ = 1; div_mainscale.onmousedown = function(event) {     var mousecoords = getcoords(event);     startx = mousecoords.x - offset[0];     starty =1 ;//mousecoords.y - offset[1];     rect = mainscale.rect(startx, starty);     document.onmousemove = dodraw;     rect.attr({fill: 'rgba(255, 6, 6, 0.41)', stroke: 'red'});      value_ = 1; }; if(($(document).onmouseup) && (value_ == 1)) // here make mistake {     selectable_area(width,startx);     rect.remove(); } 

instead of code

document.onmouseup = function() { if(rect) {     selectable_area(width,startx);     rect.remove(); }  document.onmousemove = null; }; 

but if(($(document).onmouseup) && (value_ == 1)) condition not satisfied? how can fix problem?

$(document).on("mouseup" , function(e) {     if (value_ == 1) {         value_ = 0;         selectable_area(width,startx);         rect.remove();     } }); 

Comments

Popular posts from this blog

twig - Using Twigbridge in a Laravel 5.1 Package -

firemonkey - How do I make a beep sound in Android using Delphi and the API? -

jdbc - Not able to establish database connection in eclipse -