Need a unique gift idea?
A Pastebin account makes a great Christmas gift
SHARE
TWEET

Untitled

a guest Jun 13th, 2018 45 Never
Upgrade to PRO!
ENDING IN00days00hours00mins00secs
 
  1. function SomeClass(element) {
  2.     this.element = element;
  3.     this.mouseX = 0;
  4.     this.mouseY = 0;
  5.     this.setMousePosition = function(posX, posY) {
  6.         this.mouseX = posX;
  7.         this.mouseY = posY;
  8.     };
  9.     this.listenMousePosition = function() {
  10.         var obj = this;
  11.         $(this.element).on('mousemove',null, {obj: obj}, function(e, obj)  {
  12.             e.data.obj.setMousePosition(e.offsetX, e.offsetY);
  13.             $('#output').html('X: ' + e.data.obj.mouseX + '; Y: ' + e.data.obj.mouseY);
  14.         })
  15.     }
  16.     this.listenMousePosition();
  17.  
  18.     return this;
  19. }
  20.  
  21. window.contentDiv = new SomeClass($(".content")[0]);
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top