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

powershell Start-Process exit code -1073741502 when used with Credential from a windows service environment -

twig - Using Twigbridge in a Laravel 5.1 Package -

c# - LINQ join Entities from HashSet's, Join vs Dictionary vs HashSet performance -