This blog uses responsible cookies for functionality and user preferences.
Google Analytics is used for collecting general public information to understand how my blog is used.
Learn moreDear visitors,
This blog and the Tigarus.com network will be changing our website software in May (2024). There will be some down time and there will be a change to the webpage addresses.
We will also be removing the Anime blogs. The Rocksmith Songs website will be unavailable of a few weeks or months while I move the database to the new software.
At the moment we are running on Wordpress, the new software is an in-house project which is 57 times faster. It will also provide more freedom for development.
Thank you for understanding.
Script Title: mouseButtons
Programming Language: Java Script
Date Completed: 2012/09/16
Purpose: To detect if a mouse button is pressed. Returns true or false.
Description: An easy to use system for handling Mouse buttons with Java Script.
Compatibility: Works with all modern Web browsers, with limited legacy support.
Caution: Opera browsers older than version 12 have the ability to detect the context menu action disabled by default. This means the mouse button assigned as “Right Click” will not be detectable, unless this feature is enabled by the user.
AppleWebKits based Web browsers (Safari/Chrome), version 412 and earlier only detect Left Clicks.
Method:
Functions
mouseButton.isDown( String );Determines if a button is down, returns true or false
mouseButton.isUp( String );Determines if a button is up, returns true or false
mouseButton.start();Starts mouse button listeners
mouseButton.stop();Stops mouse button listenersVariables
mouseButton.isActive;Returns true or false if the listeners are active
mouseButton.disableContextMenu;Set or Returns true if menu is disabled
mouseButton.disableCtrlClick;Set or Returns true if Ctrl is disabled
mouseButton.disableShiftClick;Set or Returns true if Shift is disabled
mouseButton.disableAltClick;Set or Returns true if Alt is disabled
mouseButton.disableCmdClick;Set or Returns true if CMD is disabled
isDown and isUp Arguments:
left
middle
right
ctrl
shift
alt
cmd
Note: Arguments are not case sensitize.
Notice: Mouse buttons are defined as actions in the computer’s system properties. Many people may not be able to detect their middle button because this button maybe assigned a different action. For example you could assign the button, the Flip action, now the button is called Flip. If you assign the Left button as Left Click, the button will be detected as Left, if you assign the Left button as Right Click the Left button is now detected as Right.
Disable Context Menu:
Default value is false, when set to true the context menu (default right click action) is disabled.
Note: Some users or Web browsers may have the ability to detect this event disabled.
Disable Control Click:
Default value is false, when set to true the Ctrl+Click action of the Web browser is disabled.
Note: Ctrl+Click to open a link in a new tab is still active, to disable this action will require the link’s behavior to be change.
Disable Shift Click:
Default value is false, when set to true the Shift+Click action of the Web browser is disabled.
Disable Alt Click:
Default value is false, when set to true the Alt+Click action of the Web browser is disabled.
Disable Command Click:
(Mac)
Default value is false, when set to true the CMD+Click action of the Web browser is disabled. This feature is for Apple computers.
Example Usage:
// left mouse button
mouseButton.start();
function onMouseEventDown() {
if ( mousedown.isDown( “Left” ) ) {
// do something
}
}
document.addEventListener(‘mousedown’, onMouseEventDown, false);
Terms of Use, Cookies, Privacy, and more, see Terms and Privacy
Third-party copyrights and trademarks featured on this site are owned by their respected holders.
Website written and designed by Patcoola 2019, some rights reserved.
This blog uses responsible cookies for functionality and user preferences.
Google Analytics is used for collecting general public information to understand how my blog is used.
Learn moreDear EU visitor, I am required to ask you consent for the following.