i got a problem with a Tooltip effect using jQuery and CSS.
I want to make a overview of a room and the seating arrangements. On every seat there is one person which got a picture and some information. The room itself has around 60 seats.
I have a picture which I placed in the background
#sitzplatzverteilung { width: 516px; height: 360px; position: relative; margin: 20px 0px; background: url("6x12x8_sitzplan.jpg") no-repeat; border: 1px solid;} next I got a seat
.platz { width: 39px; height: 50px; position: absolute; cursor: pointer; font-size: 11px; font-family: arial; border: 1px solid; } and I got the info which I want to show on a mouseover
.platz_info { display: none; background-color: #ffffff; border: solid 1px #abaaac; width: 250px; padding: 3px 5px; border: 1px solid; } every seat got its own position on the picture. I placed the .platz over every seat with
#platz1 { top: 73px; //next one got different top and left left: 2px;} my html for the seats (body)
<div id="sitzplatzverteilung"> <div id="platz1" class="platz"> <div class="platz_info"> <img src="person1.jpg" /><br> Test Text1 </div> </div> <div id="platz2" class="platz"> <div class="platz_info"> <img src="person1.jpg" /><br> Test Text2 </div> </div> </div> my script to show the tooltip
$(document).ready(function(){ $(".platz").mouseenter(function(){ $(".platz_info").hide(); $(".platz_info", this).show(0); }); $(".platz_info").click(function () { $(".platz_info").hide(); }) }); Now my problem is, if I mouseover one of the seats (platz1 platz2) my tooltip shows up. But the position on which it is shown is relative to the seat. So every tooltip opens up directly on / next to the seat which I mouseover.
I already tried to give it a top and left which only places it a bit away from the each seat. But I want the tooltip to open on a fixed position. Also with a float:right / left it only places the tooltip on left or right edge of the seat.
Is there any possibility to give the tooltip (platz_info) a fixed place to open up in?
.platz_infothen adding positive or negative margin to position it.