Skip to Content

JavaScript File

URL: http://xlib.info/js/tooltip.js?v=10
HTTP Status: 200 OK
MIME Type: application/javascript
Last Modified: Fri, 03 Apr 2020 07:55:00 GMT
Download Time: Less than a second
Cookies: None
Size: 2 KB
HTTP Headers:  10 headers
Links In:  1 pages
Links Out:  0 links
Images:  0 images
CSS:  0 files
JavaScript:  0 files
OK Issues: No issues found

1function l_tooltip(target_items, name) {

2 var tooltip = document.createElement("div");

3 tooltip.classList.add(name);

4 tooltip.id = 'tooltipNew';

5 document.body.appendChild(tooltip);

6 for (var i = 0; i < target_items.length; i++) {

7 var target_item = target_items[i];

8 target_item.setAttribute('data-title', target_item.title);

9 target_item.removeAttribute('title');

10 var tooltip = document.getElementById(name + i);

11 target_item.addEventListener('mouseover', e => {

12 let element = e.target.closest('a');

13 let tooltip = document.getElementById('tooltipNew');

14 tooltip.innerHTML = element.getAttribute('data-title');

15 tooltip.style.left = e.clientX + 15 + 'px';

16 tooltip.style.top = e.clientY + 15 + 'px';

17 }

18);

19 target_item.addEventListener('mousemove', e => {

20 let element = e.target.closest('a');

21 let tooltip = document.getElementById('tooltipNew');

22 tooltip.innerHTML = element.getAttribute('data-title');

23 tooltip.style.left = e.clientX + 15 + 'px';

24 tooltip.style.top = e.clientY + 15 + 'px';

25 }

26);

27 target_item.addEventListener('mouseout', e => {

28 let tooltip = document.getElementById('tooltipNew');

29 tooltip.style.left = -9999+'px';

30 tooltip.style.top = -9999+'px';

31 }

32);

33 }

34

35}

36

37

38l_tooltip(document.querySelectorAll(".related_posts_item"),"tooltip-j");