S
Sempervivum
Guest
Nein, Klasse und data-tt immer gleich und ohne http://:
Code:
<a href="#" data-tt="img1.png" class="masterTooltip">Your Text</a>
<a href="#" data-tt="img2.png" class="masterTooltip">Your Text</a>
<p data="img3.png" class="masterTooltip">Mouse over the heading text above to view it's tooltip.</p>
<p data-tt4="img4.png" class="masterTooltip">Mouse over the heading text above to view it's tooltip.</p>
Code:
<script type="text/javascript">
$(document).ready(function() {
$('.masterTooltip').hover(function(){
var im = $(this).attr('data-tt');
// var im = $(this).attr('data-tt2'); loeschen
// var im = $(this).attr('data-tt3'); loeschen
// var im = $(this).attr('data-tt4'); loeschen
$('<p class="tooltip"><img src=" + im + "></p>')
.appendTo('body')
.fadeIn('slow');
}, function() {
$('.tooltip').remove();
}).mousemove(function(e) {
var mousex = e.pageX + 20; //Get X coordinates
var mousey = e.pageY + 10; //Get Y coordinates
$('.tooltip')
.css({ top: mousey, left: mousex })
});
});
</script>
Zuletzt bearbeitet von einem Moderator: