Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> Tooltip problem.
Salur
post
Post #1





Grupa: Zarejestrowani
Postów: 179
Pomógł: 0
Dołączył: 28.12.2014

Ostrzeżenie: (20%)
X----


Witam, mam problem z tooltipem, zostaje on wyswietlany gdzies na samym dole a nie obok obrazka.

KOD:

  1. <script type="text/javascript" src="/panel/jquery.min.js"></script>
  2. <script type="text/javascript">
  3. $(document).ready(function() {
  4. //Tooltips
  5. $(".tip_trigger").hover(function(){
  6. tip = $(this).find('.tip');
  7. tip.show(); //Show tooltip
  8. }, function() {
  9. tip.hide(); //Hide tooltip
  10. }).mousemove(function(e) {
  11. var mousex = e.pageX + 20; //Get X coodrinates
  12. var mousey = e.pageY + 20; //Get Y coordinates
  13. var tipWidth = tip.width(); //Find width of tooltip
  14. var tipHeight = tip.height(); //Find height of tooltip
  15.  
  16. //Distance of element from the right edge of viewport
  17. var tipVisX = $(window).width() - (mousex + tipWidth);
  18. //Distance of element from the bottom of viewport
  19. var tipVisY = $(window).height() - (mousey + tipHeight);
  20.  
  21. if ( tipVisX < 20 ) { //If tooltip exceeds the X coordinate of viewport
  22. mousex = e.pageX - tipWidth - 20;
  23. } if ( tipVisY < 20 ) { //If tooltip exceeds the Y coordinate of viewport
  24. mousey = e.pageY - tipHeight - 20;
  25. }
  26. tip.css({ top: mousey, left: mousex });
  27. });
  28. });
  29. </script>
Go to the top of the page
+Quote Post

Posty w temacie


Reply to this topicStart new topic
2 Użytkowników czyta ten temat (2 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Aktualny czas: 23.08.2025 - 02:10