Javascript Drag and drop

前端 未结 4 1851
北海茫月
北海茫月 2021-01-01 04:19

I\'m looking for someone to explain how to drag and drop in javascript, I want a horizontal line with some customizable images in it.

I\'ve had a look at the online

4条回答
  •  清酒与你
    2021-01-01 04:35

    Find 2x of:

    dragHelper.style.top  = mousePos.y - mouseOffset.y;
    dragHelper.style.left = mousePos.x - mouseOffset.x;
    

    change to:

    dragHelper.style.top  = mousePos.y - mouseOffset.y + 'px';
    dragHelper.style.left = mousePos.x - mouseOffset.x + 'px';
    

    Works on FF. 3.6

提交回复
热议问题