Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [Java][CSS]tooltip w tabeli
mazyl
post
Post #1





Grupa: Zarejestrowani
Postów: 139
Pomógł: 2
Dołączył: 2.12.2011

Ostrzeżenie: (0%)
-----


Witam!

mam spory problem z umieszczeniem tooltipa na stronie,

cały kod tooltipa wygląda tak:


  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  2. <html xmlns="http://www.w3.org/1999/xhtml">
  3. <head>
  4. <title>Simple JQuery Tooltips turtorial</title>
  5.  
  6. <script type="text/javascript" src="http://code.jquery.com/jquery-latest.js"></script>
  7. <script type="text/javascript">
  8.  
  9. $(document).ready(function() {
  10.  
  11. //Select all anchor tag with rel set to tooltip
  12. $('a[rel=tooltip]').mouseover(function(e) {
  13.  
  14. //Grab the title attribute's value and assign it to a variable
  15. var tip = $(this).attr('title');
  16.  
  17. //Remove the title attribute's to avoid the native tooltip from the browser
  18. $(this).attr('title','');
  19.  
  20. //Append the tooltip template and its value
  21. $(this).append('<div id="tooltip"><div class="tipHeader"></div><div class="tipBody">' + tip + '</div><div class="tipFooter"></div></div>');
  22.  
  23. //Set the X and Y axis of the tooltip
  24. $('#tooltip').css('top', e.pageY + 10 );
  25. $('#tooltip').css('left', e.pageX + 20 );
  26.  
  27. //Show the tooltip with faceIn effect
  28. $('#tooltip').fadeIn('500');
  29. $('#tooltip').fadeTo('10',0.8);
  30.  
  31. }).mousemove(function(e) {
  32.  
  33. //Keep changing the X and Y axis for the tooltip, thus, the tooltip move along with the mouse
  34. $('#tooltip').css('top', e.pageY + 10 );
  35. $('#tooltip').css('left', e.pageX + 20 );
  36.  
  37. }).mouseout(function() {
  38.  
  39. //Put back the title attribute's value
  40. $(this).attr('title',$('.tipBody').html());
  41.  
  42. //Remove the appended tooltip template
  43. $(this).children('div#tooltip').remove();
  44.  
  45. });
  46.  
  47. });
  48.  
  49. </script>
  50.  
  51. <style>
  52. body {font-family:arial;font-size:12px;text-align:center;}
  53. div#paragraph {width:300px;margin:0 auto;text-align:left}
  54. a {color:#aaa;text-decoration:none;cursor:pointer;cursor:hand}
  55. a:hover {color:#000;text-decoration:none;}
  56.  
  57. /* Tooltip */
  58.  
  59. #tooltip {
  60. position:absolute;
  61. z-index:9999;
  62. color:#fff;
  63. font-size:10px;
  64. width:180px;
  65.  
  66. }
  67.  
  68. #tooltip .tipHeader {
  69. height:8px;
  70. background:url(images/tipHeader.gif) no-repeat;
  71. }
  72.  
  73. /* IE hack */
  74. *html #tooltip .tipHeader {margin-bottom:-6px;}
  75.  
  76. #tooltip .tipBody {
  77. background-color:#000;
  78. padding:5px;
  79. }
  80.  
  81. #tooltip .tipFooter {
  82. height:8px;
  83. background:url(images/tipFooter.gif) no-repeat;
  84. }
  85.  
  86. </style>
  87.  
  88. </head>
  89.  
  90. <body>
  91.  
  92. <div id="paragraph">
  93. A paragraph typically consists of a unifying main point, thought, or idea accompanied by supporting details. The non-fiction paragraph usually begins with the general and moves towards the more specific so as to advance an argument or point of view. Each <a rel="tooltip" title="A paragraph typically consists of a unifying main point, thought, or idea accompanied by <b>supporting details</b>">paragraph</a> builds on what came before and lays the ground for what comes next. Paragraphs generally range three to seven sentences all combined in a single paragraphed statement. In prose fiction successive details, for example; but it is just as common for the point of a prose paragraph to occur in the middle or the end. A paragraph can be as short as one word or run the length of multiple pages, and may consist of one or many <a rel="tooltip" title="Testing of Sentences">sentences</a>. When dialogue is being quoted in fiction, a new paragraph is used each time the person being quoted changed.
  94. </div>
  95.  
  96. </body>
  97. </html>


chiałbym to umiescic w tabeli, która dane pobiera z mysql

całość wygląda tak:

  1. <td><div id="paragraph"><a rel="tooltip" title="Wiek: <?php echo $p['wiek']; ?> <br>Wykształcenie: <?php echo $wyk['wyksztalcenie']; ?>"><?php echo $p['nazwisko']; ?>
  2. </a></div>
  3. </td>


jednak tooltip wyświetla się całkowicie na dole strony, im niższy rekord z tabeli tym coraz niżej, po klilku tooltip całkowicie zanika.

wie ktoś jak to naprawić ?
Go to the top of the page
+Quote Post

Posty w temacie


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

 



RSS Aktualny czas: 21.08.2025 - 03:02