javascript - How to make tooltip display beside every image -
i have several images applied jquery tooltip effect on..it works, problem irrespective of image click tooltip displays @ top of page. there way can make tooltip appear beside each image clicked.
the jquery have far looks :
$('.image').hover(function () { $('.tooltip').fadein(1000); }, function () { $('.tooltip').fadeout(1000); }); $('.tooltip').css({ top: e.pagey, left: e.pagex })
css
.tooltip { display: none; height: auto; position: absolute; background-color: #d1c585; color: black; border: 2px solid rgba(128, 0, 32, 0.3); padding: 5px; border-radius: 5px; font-family: actor; }
html
<img src="image.jpg" class="image">
it needs have position: absolute
, parent has position: relative
. inside hover function do:
$('.tooltip').css({ top: e.pagey, left: e.pagex })
Comments
Post a Comment