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

Re: [cssom-view] Add a "smooth" parameter to scrollTo and scrollBy functions

From: Simon Pieters <simonp@opera.com>
Date: Mon, 20 May 2013 13:58:35 +0200
To: www-style@w3.org, Netmosfera <netmosfera@gmail.com>
Cc: "Tab Atkins Jr." <jackalmage@gmail.com>, "Lea Verou" <lea@w3.org>, "Nat Duca" <nduca@google.com>, "James Simonsen" <simonjam@chromium.org>, "Tony Gentilcore" <tonyg@google.com>, "Tom Wiltzius" <wiltzius@google.com>
Message-ID: <op.wxdsvxwpidj3kv@simons-macbook-pro.local>
On Sun, 19 May 2013 13:52:16 +0200, Netmosfera <netmosfera@gmail.com>  
wrote:

> (i didn't read the whole discussion)
>
> here's my opinion... some months ago i've suggested something similar on  
> mozilla's bugzilla
>
> i don't actually like the idea of the "smooth scrolling" argument of  
> scrollTo and scrollBy methods, because i think this should be applied  
> also to scrollTop and scrollLeft properties

With scrollTop and scrollLeft, I see these options:

* Don't support smooth scrolling (except when set by CSS)
* Introduce new methods e.g. scrollTopSmooth and scrollLeftSmooth
* Introduce a new attribute on Element that acts as a flag for scrollTop  
and scrollLeft
* Let scrollTop and scrollLeft take an object as value e.g.: { value:10,  
smooth:true }

The last option could work for scroll() et al, too.

> i don't also like the idea of a global flag that enables or disables  
> globally the smooth scrolling on cssom methods/properties

Why not? (The proposed CSS property would be per-element, not global.)

> so what about something like this instead
>
> html {  transition:scrolling 0.5s ease-in-out 0; }
>
> this could be applied to any scrolling related event, for example when  
> linking to a page.html#fragment , when set by scrollLeft|Top and co.

This seems equivalent to the proposed CSS property to enable smooth  
scrolling for an element (or viewport for the root element), except this  
supports setting time and timing function and doesn't support using the  
platform's native time/timing function. It also means we can't add a CSS  
property called 'scrolling'.

> but, it's not easy determine how this should work... at a rough guess,  
> here's some random ideas
>
>          html { scrolling-x: 0;                 scrolling-y:400px; }
>          html { scrolling-x: 100px;        scrolling-y:  
> element(#fragment); }      /* this should not change the url's  
> fragment... it just simulates a scroll */
>          html { scrolling-x: 0;                scrolling-y:  
> element(#content > p:nth-child(1) ); }
>
> the default UA style could be:
>         * { scrolling:target; }            /* that is calculated to the  
> url's fragment or otherwise 0,0 (with possible exceptions for rtl  
> languages) */
>
> ... and, for animating this:
>
>           html {  transition: scrolling-x 0.5s ease-in-out 0,  
> scrolling-y 1s linear 0; }
>          !* *:target {  transition: scrolling 0.5s ease-in-out 0; }
>
> maybe in a later moment, some more effort for this could be needed...  
> for a better scrolling control
>
> html {  transition: scrolling-delta-x 0.1s ease-in-out 0; }
>
> hoping to be helpful...
> Giorgio
>
> (sorry for the possible double email... still not understanding why  
> messages get filtered)

It's not clear to me what problem you're trying to solve here that a  
single CSS property dedicated to enabling smooth scrolling doesn't solve.

-- 
Simon Pieters
Opera Software
Received on Monday, 20 May 2013 11:59:42 UTC

This archive was generated by hypermail 2.4.0 : Friday, 25 March 2022 10:08:30 UTC