Advertisement
Guest User

Tooltip styling

a guest
Jun 15th, 2019
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.32 KB | None | 0 0
  1. // **Java snippet below.** //
  2.  
  3. $(document).ready(function() {
  4. // Tooltip only Text
  5. $('.masterTooltip').hover(function(){
  6. // Hover over code
  7. var title = $(this).attr('title');
  8. $(this).data('tipText', title).removeAttr('title');
  9. $('<p class="tooltip"></p>')
  10. .text(title)
  11. .appendTo('body')
  12. .fadeIn('slow');
  13. }, function() {
  14. // Hover out code
  15. $(this).attr('title', $(this).data('tipText'));
  16. $('.tooltip').remove();
  17. }).mousemove(function(e) {
  18. var mousex = e.pageX + 20; //Get X coordinates
  19. var mousey = e.pageY + 10; //Get Y coordinates
  20. $('.tooltip')
  21. .css({ top: mousey, left: mousex })
  22. });
  23. });
  24.  
  25.  
  26.  
  27.  
  28. // **HTML Snippet below** //
  29.  
  30. <span style="color: #000;"><a class="masterTooltip" title="ENTER WHAT YOU WANT IT TO SAY ON HOVER HERE!" href="https://roleplay.chat/profile.php?user=LINK" target="_blank"></a></span>
  31.  
  32. // **CSS styling below** //
  33.  
  34. .tooltip {
  35. display:none; position:absolute; max-width: 150px; padding: 10px;
  36. border:1px solid #fff;
  37. background: #000;
  38. z-index: 14;
  39. font-family: calibri; font-size: 10px; letter-spacing: 1px; color: #fff;
  40.  
  41. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement