- From: Garrett Smith <dhtmlkitchen@gmail.com>
- Date: Mon, 8 Oct 2012 14:38:22 -0700
- To: Jussi Kalliokoski <jussi.kalliokoski@gmail.com>
- Cc: www-style@w3.org
On 10/8/12, Jussi Kalliokoski <jussi.kalliokoski@gmail.com> 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 write. 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 ... http://www.highdots.com/forums/1255048-post42.html 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. -- Garrett Twitter: @xkit personx.tumblr.com
Received on Monday, 8 October 2012 21:38:44 UTC