I use canvas as a background for a certain div . Clicking on the "button" displays additional objects and canvas . Using jQuery, I get the position of these objects in pixels and draw a line from the object to the “button” on the canvas. The code works fine for the very first example, but when you click on the following "button" part of the code is ignored:
target.closest(".contain").find(".servers .object").each(function(){ ctx.moveTo(pos_x, pos_y_1); ctx.lineTo(pos_x, pos_y_2); pos_x += width; }); Those. he does not find "objects" and does not draw. I just can not understand what it is connected with. To make it clearer, I bring all the code here: http://codepen.io/anon/pen/xgGGoN