W3C home > Mailing lists > Public > www-style@w3.org > March 2016

Re: [css-position] events for position sticky

From: Xidorn Quan <quanxunzhen@gmail.com>
Date: Tue, 15 Mar 2016 22:51:06 +0800
Message-ID: <CAMdq6992Jz8n_zbguWttK2-4_SUO4-nVWdzavLWEV6RuCOx37Q@mail.gmail.com>
To: Aurelio De Rosa <a.derosa@audero.it>
Cc: www-style list <www-style@w3.org>
On Fri, Mar 11, 2016 at 3:47 PM, Aurelio De Rosa <a.derosa@audero.it> wrote:

>
> Hi everyone.
>
> The specifications of position: sticky don't mention any event fired when
> an element is stuck and when it returns to its original position, for
> example something like stickystart and stickyend. I think this could be
> very useful and it has different use cases.
>
> The first use case is a website that needs to decrease the margin of a
> navigation bar when it starts sticking. Another use case might be to have
> an element that takes the full width of the page when it's sticking but a
> different width when it's in its original position.
>
> Has anyone thought about this possibility? Has this topic been discussed
> before?
>

You should just do all of these in CSS. It doesn't seem to me any of you
requirements is undoable in CSS. Probably you need more concrete example.

In addition, what sticky wants to do is to make this effect
JavaScript-free, so that it could be smoothly rendered. If you want to use
JavaScript, you can just go back and listen on scroll event and do
everything you like there. Using sticky with those two events wouldn't make
anything better than just using scroll event, I suppose.

- Xidorn
Received on Tuesday, 15 March 2016 14:52:13 UTC

This archive was generated by hypermail 2.4.0 : Friday, 25 March 2022 10:09:01 UTC