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
Post a Comment