views:

197

answers:

3

Hi, I have been trying to implement many different tooltips on this page for my client, he's adamant that we have a picture of the product show up when you hover over the product name in the order page. I decided to use the super simple CSS tooltip, it's very easy to implement and does exactly what we want. It works on a dynamic page, the others I tried didn't.

I have made an example here: CSS tooltip in table example.<-- updated to remove errors.

This page used to be displayed using divs, I have since changed it to a table, as it's tabular data and easier to work with. It worked fine when it used divs, now it's in a table, it won't display the span on hover.

My questions are:

  1. Why is it not working?

  2. How can I make it work?

  3. If not, does anyone know another super easy to implement tooltip that can work properly on a dynamic page?

Here's the DIV tooltip for reference: DIV display tooltip.

Edit: Just noticed it kinda half works in IE8.

Update: It's now working in all browsers, thanks to Daniel pointing out my CSS errors, but is there a way to make it display outside of the table cell?

PAge is at: here

Thanks.

+1  A: 

I have checked your code, and as you can see by the jsfiddle sytax hightlighting there are a lot of errors in your code: for example the span you who starts in your a finishes outside your a. The CSS should work like this. There are a few more errors. i think if you correct them its gonna work. (simply pass the w3c check, then anything should be just fine)

edit: i missed a thing your link should be position: relative; because your tooltip is position: absolute, the absolute always is relative to the last relative parent.

also remove the opacity: 0 in your original span

meo
Thanks, I've cleaned up those errors, but still nothing.
Kyle Sevenoaks
i have edited my answer
meo
Change the positoning, still not working. Still half works in IE8, it displays the hidden span but only within the bounds of the table cell.
Kyle Sevenoaks
look it works: http://jsfiddle.net/dbZTK/6/ you had a opacity: 0 in your original span (it works in IE because ie does not support CSS opacity, i uses his own crap ;P )
meo
Thanks Meo! Helped a lot!
Kyle Sevenoaks
+2  A: 

You seem to have a problem with CSS. Simply using styles of the working JSFiddle demo should fix it. You had the span set as display:none, however it looks like this tooltip works by hiding the image from the screen, using left:-999px.

Check this: http://jsfiddle.net/WNzhJ/

Daniel Vassallo
Thanks Damiel, I did try to make the styles the same.
Kyle Sevenoaks
+2  A: 

Find a more readable working solution here: http://jsfiddle.net/n9GdP/1/

codescape
This looks helpful +1
Daniel Vassallo
Very helpful! much more simple than my version :) +1
Kyle Sevenoaks
I added this to my site, works the same as my previous version, only displays the span within the confines of the table cell.. Is there a way to override this? Have it working here: http://jsfiddle.net/Mcv7P/Just not in my actual site..
Kyle Sevenoaks
Your css holds many `z-index` definitions. Clear them up or add `z-index:99999;` to the class `.hasTooltip span { ... }` to work around this problem. Another cause for your problem might be different `display: ...` values overriding each other. Put both css-classes from my example for the tooltip to the bottom of your css definitions or add `!import` to these attributes.
codescape
Ok, got it working, changed the position of cart2Produkt to absolute and hasTooltip to relative. This produced another problem though...
Kyle Sevenoaks