Re: position: pointer

On 10/8/12, Jussi Kalliokoski <> wrote:
> Hi everyone,
> I wanted to discuss the possibility of adding a new `position` type called
> `pointer`. I came up with the idea as I was thinking about how limited
> `title` attribute tooltips are, which made me check out the JS libraries
> for the purpose, which are crappy as well, and I think JS shouldn't be
> needed for "simple" positioning of elements like this (there may be a few
> cycles to save here as well). The idea is pretty simple, it works kinda
> like absolute or fixed position (in that the element is floating), but the
> given coordinates are relative to the main pointer position.
> This would let you make tooltips in pure CSS and HTML (not to mention that
> you could recreate those stars flying around the mouse from the 90s with
> just CSS and HTML ;). I made a small demo [1] [2] to give a better picture
> of what I mean. The actual demo uses a silly JS shim, and I think the
> smoothness speaks for itself about how unsuitable JS is for this kind of
> functionality.
This seems like a big simplification of a common problem.

Simplicity is more of a benefit than the performance. The smoothness
of the JS shim can be improved but such things are still a pain to

Part of the problem with these things is the problem of "where is my
element located"? The`offsetLeft/offsetTop` which your code uses are
wildly inconsistent between browsers, versions, doctype,
elements/containing blocks, layout, phase of the moon, etc. Never
should've been spec'd in the first place. Replacing that with
position: pointer is nice.

A time threshold event throttle as `lastMouseMoveTime` reduces the
frequency of code execution inside the mousemove handler, thereby
reducing cycles. I've explained it a few times on comp.lang.javascript
and SO ...

Do you want it to always track, as on mousemove? Any option where the
element is shown at the pointer and then doesn't follow?

At first glance, the expressiveness and simplicity afforded by this
proposal promises to make this problem area easier to tackle.
Twitter: @xkit

Received on Monday, 8 October 2012 21:38:44 UTC