Guest User

Untitled

a guest
Jan 6th, 2018
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.   var width, height, divObj, interval;
  2.         var l, t, r, b;
  3.  
  4.         function setup() {
  5.                 width = window.innerWidth;
  6.                 height = window.innerHeight;
  7.                 interval = setInterval(loadDiv, 50);
  8.         }
  9.  
  10.         document.onmousemove=getMouseCoordinates;
  11.            
  12.         function getMouseCoordinates(event) {
  13.             ev = event || window.event;
  14.            
  15.             l = ev.pageX; t = ev.pageY;
  16.             r = width - l; b = height - t;
  17.                    
  18.             divObj.innerHTML = '<div style="position: absolute; left: 20px;">.class {<br>&nbsp;&nbsp;&nbsp;position: absolute;<br>&nbsp;&nbsp;&nbsp;left: ' + l + 'px;<br>&nbsp;&nbsp;&nbsp;top: ' + t + 'px;<br>}</div><div style="position: absolute; left: 250px;">.class {<br>&nbsp;&nbsp;&nbsp;position: absolute;<br>&nbsp;&nbsp;&nbsp;right: ' + r + 'px;<br>&nbsp;&nbsp;&nbsp;bottom: ' + b + 'px;<br>}</div>';      
  19.         }
  20.        
  21.         function loadDiv() {
  22.             divObj = document.getElementById("divPlacement");
  23.         }
  24.              
  25.         document.write('<div id="divPlacement" style="position: absolute; right: 25px; bottom: 25px; color: #fff; font-family: monospace; background-color: #000; opacity:0.4; filter:alpha(opacity=40); -webkit-border-radius: 5px;-moz-border-radius: 5px; border-radius: 5px; padding: 10px; width: 420px; height: 80px; border: solid #ccc;"></div>');
  26.        
  27.         setup();
Add Comment
Please, Sign In to add comment