How to get mouse x and y position in ember?


#1

I have a div and I have registered action helper showTip inside the action hash showTip I want to get the mouse x and y position. How to get it.

Please help.

actions : {
    showTip () {
        //get the mouse x and y position so that I can show the tip at proper location.
    }
}

#2

Ember does nothing special with mouse event.

Therefore, the way to know where the cursor is the same as with plain javascript or jQuery. You may find some hints on stackoverflow: http://stackoverflow.com/questions/11245119/how-to-get-mouse-pointer-position-using-javascript-for-internet-explorer

Long story short: if you are not in the process of handling a mouse event, getting cursor position is tedious. On the other hand, if you are in the process of handling a mouse event, it’s available on the event itself.


#3

Thanks Spektras,

I did it as we do it in ourl plain javascript thanks for the reply