Capture and Stop Middle Click

I know - this has been asked before, HOWEVER: People keep saying "you can't do that in Firefox", etc. etc. (specifically, this answer: Disabling middle click scrolling with javascript)

...then how does this do it? http://www.lokeshdhakar.com/projects/lightbox2/

  1. It's in Prototype/Scriptaculous, but my Google-fu is failing me.
  2. I can't reproduce it in jQuery/MooTools (http://jsfiddle.net/ezSR4/1/)
  3. It looks tied to the Prototype implementation of events, but perhaps someone knows better than my quick investigation?

It captures the middle clicks, prevents a new window, and fires the correct event to open the overlay. I'm just not as familiar with Prototype as I am with the other libraries, and hope someone can point out the obvious.

TIA.

Answers


he is using the click event directly on the document object then it checks if it is on one of those picture links

so that would be the solution for right and middle click

  document.addEventListener("click", function(e){
    if(e.button == 1){
      e.preventDefault();
      alert(e.button);
    }
  }, true);

Need Your Help

OutputStreams in Java

java swing file-io outputstream

I was looking through the documentation for FileOutputStream and ObjectOutputStream, and I haven't seen any methods for moving the "write pointer" to a specified spot (although I have seen a constr...

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.