Re: [mediaqueries] Proposal for scroll-position Media Query

On Thu, 25 Sep 2014 14:37:53 +0200, Bennett Feely <bfeelyweb@gmail.com>  
wrote:

> More and more websites feature stylistic changes that are triggered via  
> javascript once or after the user reaches a certain point scrolling down  
> the page.

This is definitely something that happens a lot, so having some built in  
mechanism to deal with it would be nice.

>
> I think a CSS Media Query for "scroll-position" would be incredibly  
> beneficial for the web and could tackle a large range of issues relevant  
> to the current state of web >design without introducing a stockpile of  
> new and fragmented CSS properties.

The main problem I see is that Media Queries are resolved before style is  
applied to the page, and therefore before layout is done. However, to be  
able to know the scroll position, you need to do the layout first, to  
determine the height of the content, so that you have something to scroll  
in.

This means Media Queries is the wrong tool for the job. This is not just  
an arbitrary limitation we could lift just by saying so. If Media Queries  
can depend on layout, we would be introducing cycles, (since layout  
certainly depends on Media Queries), and that would be a Bad Thing (tm).

  - Florian

Received on Sunday, 5 October 2014 10:58:58 UTC