开发者

Retrieve the position of a clicked button?

开发者 https://www.devze.com 2023-02-14 19:52 出处:网络
Well, everything is on the question. I have a clickEvent on one of my button and i want to retrieve the position of this button when i click on it.

Well, everything is on the question. I have a clickEvent on one of my button and i want to retrieve the position of this button when i click on it.

Actually i retrieve the position event.pageX but it's not really what i want...

&开发者_Python百科lt;script type=text/javascript>
    $( "#dM1").click( function(event) {
        dropMenu('dropMenu1', event.pageX);
    });
</script>


$(this).position() will have information regarding the object that was clicked within your event handler relative to the offset parent. $(this).offset() has positioning information relative to the document.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号