Show More
@@ -25,6 +25,14 b" document.addEventListener('DOMContentLoa" | |||
|
25 | 25 | tooltip.textContent = initTooltipText; |
|
26 | 26 | sourcelines.appendChild(tooltip); |
|
27 | 27 | |
|
28 | //* position "element" on top-right of cursor */ | |
|
29 | function positionTopRight(element, event) { | |
|
30 | var x = (event.clientX + 10) + 'px', | |
|
31 | y = (event.clientY - 20) + 'px'; | |
|
32 | element.style.top = y; | |
|
33 | element.style.left = x; | |
|
34 | } | |
|
35 | ||
|
28 | 36 | var tooltipTimeoutID; |
|
29 | 37 | //* move the "tooltip" with cursor (top-right) and show it after 1s */ |
|
30 | 38 | function moveAndShowTooltip(e) { |
@@ -33,10 +41,7 b" document.addEventListener('DOMContentLoa" | |||
|
33 | 41 | window.clearTimeout(tooltipTimeoutID); |
|
34 | 42 | } |
|
35 | 43 | tooltip.classList.add('hidden'); |
|
36 | var x = (e.clientX + 10) + 'px', | |
|
37 | y = (e.clientY - 20) + 'px'; | |
|
38 | tooltip.style.top = y; | |
|
39 | tooltip.style.left = x; | |
|
44 | positionTopRight(tooltip, e); | |
|
40 | 45 | tooltipTimeoutID = window.setTimeout(function() { |
|
41 | 46 | tooltip.classList.remove('hidden'); |
|
42 | 47 | }, 1000); |
@@ -152,6 +157,8 b" document.addEventListener('DOMContentLoa" | |||
|
152 | 157 | var div = divAndButton[0], |
|
153 | 158 | button = divAndButton[1]; |
|
154 | 159 | inviteElement.appendChild(div); |
|
160 | // set position close to cursor (top-right) | |
|
161 | positionTopRight(div, e); | |
|
155 | 162 | |
|
156 | 163 | //** event handler for cancelling selection */ |
|
157 | 164 | function cancel() { |
General Comments 0
You need to be logged in to leave comments.
Login now