The Official Blog of Patcoola

Im just a dude watching over my parents,
and trying to make cartoons and video games from home.

Script: Mouse [JS API]

Important!

Dear 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.

, By Patcoola

Script Title: mouse
Programming Language: Java Script
Date Completed: 2013/06/05

Purpose: Provides an easy to use API for working with mouse events and functions in a Web page.

Advertisement

Donate Now!

This might not be the best time, but making a blog is not easy. Would you consider donating?


Description: Mouse API for working with mouse events and functions. Includes cross browser compatibility with unified features.

Compatibility: Works with all modern Web browsers, some legacy support.

Special Compatibility Notes:

Opera 9 and over is supported.
Opera may have detect right click and context menu disabled by default.
Webkits 412 and under only supports left click detection.

Methods:

Properties

mouse.position.x
Returns a number value measured in pixels, returns the mouse’s X position.

mouse.position.y
Returns a number value measured in pixels, returns the mouse’s Y position.

mouse.position.inner.x
Returns a number value measured in pixels, returns the mouse’s X position, within an element.

mouse.position.inner.y
Returns a number value measured in pixels, returns the mouse’s Y position, within an element.

mouse.disable.contextMenu
Set or returns true or false, set to disable the mouse’s context menu, default value false.

mouse.disable.ctrlClick
Set or returns true of false, set to disable the ctrl+click command, default value false.

mouse.disable.shiftClick
Set or returns true or false, set to disable the shift+click command, default value false.

mouse.disable.altClick
Set or returns true or false, set to disable the alt+click command, default value false.

mouse.disable.cmdClick
Set or returns true or false, set to disable the cmd+click command, default value false.
Apple computer exclusive.

mouse.disable.scroll
Set or returns true or false, set to disable the mouse’s scroll wheel, prevents the scrolling action, default value false.

mouse.wheel
Returns a number value, returns the mouse wheel rotation value.

mouse.target.over
Returns an element, returns the HTML element the mouse is currently Hovered over.

mouse.target.down
Returns an element, returns the HTML element the mouse is currently hold down on.

mouse.isActive
Returns true or false, returns true if the mouse API is active.

mouse.isContextMenu
Returns true or false, returns true if the context menu event has fired, value resets to false after 1 second after the event.

Functions

mouse.target.setInner()
Function to target an HTML element to listen for the inner mouse position.

mouse.target.clearInner()
Function to remove set inner target element.

mouse.isDown( button_s )
Function returns true or false, determines if the mouse is held down.

mouse.isUp( button_s )
Function returns true or false, determines if the mouse is up.

mouse.start()
Function to start the mouse API.

mouse.stop()
Function to stop the mouse API.

isDown and isUp Arguments:

left
middle
right
ctrl
shift
alt
cmd

Note: Arguments are not case sensitize.
Note: (ctrl, shift, alt, cmd) event is fired when the key is held down while the mouse is up or down

 

Advertisement

Donate Now!

Hi there, I spend a lot of time making this blog.

It would be great if you would consider donating.


 

Post Meta

Share Post

 

Comments: Write Comment

Be the first to write a comment.


Leave a Comment


All comments are reviewed before publishing. Comments must be related to the page topic, must not be spam, and must comply with the criminal code of Canada.