JavaScript Library For Mouse Position Tracking And User Input Prediction – Trial.js

Category: Javascript , Recommended | May 20, 2016
Author:MarkoCen
Views Total:1,030 views
Official Page:Go to website
Last Update:May 20, 2016
License:MIT

Preview:

JavaScript Library For Mouse Position Tracking And User Input Prediction – Trial.js

Description:

Trial.js is a very small JavaScript library that tracks the user’s mouse position and executes callback functions when the mouse enters or leaves a specific element.

See also:

Basic usage:

Import the Trial.js JavaScript library into your html file.

<script src="trial.min.js"></script>

Execute a function when the mouse enters elements’ monitoring area.

Trial(selector).enter(
  { distance: 100, cord: 'center'},
  function(distance, ele, event){
    //do something...
  )
);

Execute a function when the mouse leaves elements’ monitoring area.

Trial(selector).leave(
  { distance: 100, cord: 'center'},
  function(distance, ele, event){
    //do something...
  )
);

Execute a function when the mouse is within a specific element.

Trial(selector).within(
  { // options },
  function(distance, ele, event){
    //do something...
  )
);

Unbind an event handler for specific event, eventName could be within, enter, leave.

Trial(selector).off(eventName);

All default options.

  • distance {Number} : determine the radius of the circular area
  • cord {String} : determine the center of the circular area, could be center, topLeft, topCenter, topRight, centerLeft, centerRight, bottomLeft, bottomCenter, bottomRight

You Might Be Interested In:


Leave a Reply