1.1.0 • Published 6 years ago

cursor_tracker v1.1.0

Weekly downloads
4
License
MIT
Repository
github
Last release
6 years ago

Cursor tracker

This plugin tracks cursor position values. Like position on x or y axis and angle. Returned values only applies to the called element. This plugin is dependent on jQuery.

git link

Guide

Example

HTML

<body>
   <div class="container">
           
   </div>
</body>

or

<body>
   <div class="container" data-dec="1">
           
   </div>
</body>

data-dec="1" means that returned value will be with one decimal point (format x.x). Default value is 2 (format x.xx).

JS

$(".container").cursor('click', function(values){
    console.log(values.angle);
});

Click (or any other event) will return cursor position value in degres.

Attributes

angle -(degres) in relation to the center of the element

angleRad -(radians) in relation to the center of the element

xAxis -(percentages) cursor position in relation to the left top corner of the element

yAxis -(percentages) cursor position in relation to the left top corner of the element

xAxisCentered -(percentages) cursor position in relation to the center of the element

yAxisCentered -(percentages) cursor position in relation to the center of the element

corner -corner of the element -returned value is in format 0, 0, 0, 0 and it represents left top, right top, left bottom, right bottom. A corner where the cursor is, will return the value 1 while other will be 0.

DEMO

DEMO 2

1.1.0

6 years ago

1.0.9

6 years ago

1.0.8

7 years ago

1.0.7

7 years ago

1.0.6

7 years ago

1.0.5

7 years ago

1.0.4

7 years ago

1.0.3

7 years ago

1.0.2

7 years ago

1.0.1

7 years ago

1.0.0

7 years ago