W3C home > Mailing lists > Public > www-style@w3.org > April 2013

Re: [mediaqueries4] Media queries for viewport positions

From: François REMY <francois.remy.dev@outlook.com>
Date: Wed, 17 Apr 2013 06:48:59 +0000
Message-ID: <DUB405-EAS3324E7C5F64FC27086AF8F9A5CE0@phx.gbl>
To: Chris Wilson <hello@iamchriswilson.com>, Tab Atkins Jr. <jackalmage@gmail.com>
CC: CSS WG <www-style@w3.org>
I believe another use case would be to change the background of the page based on the scroll position, or to start an animation when the user scrolled for a certain amount only.


It seems to enable things similar to your scroll-based animation time source proposal, in fact. 





De : Tab Atkins Jr.
Envoyé : ‎mercredi‎ ‎17‎ ‎avril‎ ‎2013 ‎01‎:‎42
À : Chris Wilson
Cc : www-style list


On Tue, Apr 16, 2013 at 10:12 AM, Chris Wilson <hello@iamchriswilson.com> wrote:
> Is there anything preventing the creation of media queries based on the
> viewport position? More specifically, a media query that would fire x
> distance from the top of the document? To stay brief the rough basic spec
> would be something like this.
>
> @media type="viewport" from(height: 300px) to(height:800px) {
> ...
> }
>
> This will then give specific styles when the viewport is between 300-800px
> from the top of the document. There is a lot of possibility for use and
> growth an media query of this type.

I suspect one of the major uses for this kind of thing will be to do
"sticky" elements, which scroll normally until they would scroll off
the page, at which point they flip to being position:fixed.  This case
is much better solved by using "position: sticky;".

Are there other use-cases you can imagine for this?  Can you describe them?

~TJ
Received on Wednesday, 17 April 2013 06:52:42 UTC

This archive was generated by hypermail 2.3.1 : Monday, 2 May 2016 14:39:10 UTC