Sehr geehrte Php.de Community ^^,
Ich habe ein Script wo ein Bild ausgegeben wird, nun möchte ich das per ToolTip noch spezielle Daten ausgegeben werden d.h man geht übers bild und bekommt verschiedene Daten
Mein Problem besteht darin das die Daten nicht mit dem Mousover reagieren fazit. Deteils werden unter dem Bild angezeigt in Normaler Schrift wenn man mit der Maus drüber fährt..
Ausgabe:
Tooltip Css und Script Code:
Ich bedanke mich schonmal für eure Hilfe
Ich habe ein Script wo ein Bild ausgegeben wird, nun möchte ich das per ToolTip noch spezielle Daten ausgegeben werden d.h man geht übers bild und bekommt verschiedene Daten
Mein Problem besteht darin das die Daten nicht mit dem Mousover reagieren fazit. Deteils werden unter dem Bild angezeigt in Normaler Schrift wenn man mit der Maus drüber fährt..
Ausgabe:
PHP-Code:
echo
'<center><a rel="tt"><img src="'.$bild['bildlink'].'"
/></a><div
style="display:none;">'.$bild['name'].'</div></center>';
Code:
<style> body {font-family:arial;font-size:12px;text-align:center;} div#paragraph {width:300px;margin:0 auto;text-align:left} a {color:#aaa;text-decoration:none;cursor:pointer;cursor:hand} a:hover {color:#000;text-decoration:none;} .clear {clear:both} /* Tooltip */ #tooltip { position:absolute; z-index:9999; color:#fff; font-size:10px; width:180px; } #tooltip .tipHeader { height:8px; background:url(images/tipHeader.gif) no-repeat; } #tooltip .tipBody { background-color:#000; padding:5px 5px 5px 15px; } #tooltip .tipFooter { height:8px; background:url(images/tipFooter.gif) no-repeat; } </style> <script type="text/javascript" src="http://code.jquery.com/jquery-latest.js"></script> <script type="text/javascript"> $(document).ready(function() { //Select all anchor tag with rel set to tooltip $('a[rel=tt]').mouseover(function(e) { //Grab the title attribute's value and assign it to a variable var tip = $(this).next().html(); //Remove the title attribute's to avoid the native tooltip from the browser $(this).attr('title',''); //Append the tooltip template and its value $(this).append('<div id="tt"><div class="tipHeader"></div><div class="tipBody">' + tip + '</div><div class="tipFooter"></div></div>'); //Set the X and Y axis of the tooltip $('#tt').css('top', e.pageY + 10 ); $('#tt').css('left', e.pageX + 20 ); //Show the tooltip with faceIn effect $('#tt').fadeIn('500'); $('#tt').fadeTo('10',0.8); }).mousemove(function(e) { //Keep changing the X and Y axis for the tooltip, thus, the tooltip move along with the mouse $('#tt').css('top', e.pageY + 10 ); $('#tt').css('left', e.pageX + 20 ); }).mouseout(function() { $(this).attr('title',$('.tipBody').html()); //Remove the appended tooltip template $(this).children('div#tt').remove(); }).next().hide(); }); </script>
Kommentar