[ 6 posts ]

Sarbbottam Bandyopadhyay

  • Username: sarbbottam
  • Joined: Wed Feb 02, 2011 12:58 am
  • Posts: 40
  • Offline
  • Profile

Mouse button detection

Post Posted: Wed Feb 02, 2011 1:10 am
+0-
Hi,

I would like to know how do I detect which mouse button has been clicked?
Looking for mousedown - e.which || e.button ...

Ultimate goal is to disable right click in an window.

Looking forward to guidence.

Thanks,
Sarbbottam.

Alberto Santini

YUI Contributor

  • Offline
  • Profile
Tags:

Re: Mouse button detection

Post Posted: Wed Feb 02, 2011 2:40 pm
+0-
Hello Sarbbottam.

I provide a working example disabling right click on the body.

http://www.pastie.org/1523262

There are different solutions.
You can read about events [1] and contextmenu [2].

Regards,
IceBox

[1] http://developer.yahoo.com/yui/event/
[2] http://developer.yahoo.com/yui/menu/#usingcontextmenu

Sarbbottam Bandyopadhyay

  • Username: sarbbottam
  • Joined: Wed Feb 02, 2011 12:58 am
  • Posts: 40
  • Offline
  • Profile

Re: Mouse button detection

Post Posted: Thu Feb 03, 2011 4:53 am
+0-
Thanks Alberto,

May be I am silly, I could not find the desired (Disable Right Click) using YUI 3.x.

The other reply of your using YUI 2.x seems a little confusing to me (novice user FrontEnd guy).

Can you share any working example??

Thanks,

Sarbbottam Bandyopadhyay

  • Username: sarbbottam
  • Joined: Wed Feb 02, 2011 12:58 am
  • Posts: 40
  • Offline
  • Profile

Re: Mouse button detection

Post Posted: Thu Feb 03, 2011 5:07 am
+0-
Hi Alberto,

I wonder if there is any event called 'rightclick'???
Is there any event for right click???

For example:
Y.on('click', function(e) {
Y.log(e.button);
}, '.numericText')

Regards,
Sarbbottam

Alberto Santini

YUI Contributor

  • Offline
  • Profile

Re: Mouse button detection

Post Posted: Thu Feb 03, 2011 5:14 am
+0-
Hello Sarbbottam.

I am confused too. :)

This is YUI2.x section and I posted a working example in the previous post.
I applied an empty context menu to disable right click.

There is not yet a similar solution for YUI3.
So you should handle the right click, handling mouse down event in a similar way you did for key events. Debugging the event object may help you.

Anyway, the follow-up in YUI3 section. :)

Regards,
IceBox

Alberto Santini

YUI Contributor

  • Offline
  • Profile
Tags:

Re: Mouse button detection

Post Posted: Thu Feb 03, 2011 5:29 am
+0-
Hello Sarbottam.

For YUI3 hint see viewtopic.php?f=18&t=7059

Regards,
Alberto
  [ 6 posts ]
Display posts from previous:  Sort by  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum