W3C home > Mailing lists > Public > www-style@w3.org > August 2014

Re: sticky positioning not enough?

From: Robert O'Callahan <robert@ocallahan.org>
Date: Tue, 19 Aug 2014 12:09:55 +1200
Message-ID: <CAOp6jLYP-Wmhhvav+KmpBhDJ_W0r4U67DOdrzgVTx5gRywMtQw@mail.gmail.com>
To: Daniel Glazman <daniel.glazman@disruptive-innovations.com>
Cc: "www-style@w3.org" <www-style@w3.org>
On Mon, Aug 18, 2014 at 8:24 PM, Daniel Glazman <
daniel.glazman@disruptive-innovations.com> wrote:

> I was browsing Cnet's web site [1] this morning and started playing a
> little bit with the scrollbar to see how scrolling affects the top
> toolbar. Sticky positioning does not seem enough to express such
> behaviour. I started thinking we need media queries based on scrollbars'
> positions but that could probably create infinite loops. Then I
> saw that a :sticky pseudo-class would do the trick and would be very
> easy to handle from an author's point of view. What do you think?
>

It would be difficult to implement ::sticky pseudo-class in a way that
performs better than just doing the equivalent effects in script, at least
for the CNET case.

For CNET today, I would advocate using position:sticky on their sticky bar
and using a scripted "scroll" event listener to switch between the two
renderings. It wouldn't be perfect --- the switch between renderings of the
sticky bar would sometimes lag the bar reaching or leaving the top of the
window --- but it would look and feel better than just using script.

Note that if we implement the idea of allowing Web Animations to be driven
by scroll position, then authors can implement the equivalent of ::sticky
by having two copies of the content, and using a step animation to switch
between them. This would give ideal performance since the browser would
prerender both copies and switch between them asynchronously.

Rob
-- 
oIo otoeololo oyooouo otohoaoto oaonoyooonoeo owohooo oioso oaonogoroyo
owoiotoho oao oboroootohoeoro oooro osoiosotoeoro owoiololo oboeo
osouobojoeocoto otooo ojouodogomoeonoto.o oAogoaoiono,o oaonoyooonoeo
owohooo
osoaoyoso otooo oao oboroootohoeoro oooro osoiosotoeoro,o o‘oRoaocoao,o’o
oioso
oaonosowoeoroaoboloeo otooo otohoeo ocooouoroto.o oAonodo oaonoyooonoeo
owohooo
osoaoyoso,o o‘oYooouo ofooooolo!o’o owoiololo oboeo oiono odoaonogoeoro
ooofo
otohoeo ofoioroeo ooofo ohoeololo.
Received on Tuesday, 19 August 2014 00:10:22 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 19 August 2014 00:10:23 UTC