Positioning Context Menu

后端 未结 3 1020
孤城傲影
孤城傲影 2021-02-20 02:15

I\'m trying to position a custom context menu with jQuery.
The first time it appears at the right position (mouse coordinates), but then the current position is being summed

3条回答
  •  鱼传尺愫
    2021-02-20 03:01

    Don't use offset method, try css instead, positioning context menu absolutely:

    $("#box").css({left:e.pageX, top:e.pageY});
    

    CSS:

    #box {
        ...
        position: absolute;
    }
    

    http://jsfiddle.net/smxLk/

提交回复
热议问题