Xiao Ai mini official website page of the local scrolling is how to achieve?

https://www.mi.com/aispeaker-.

clipboard.png
after scrolling to the location of the broadcast map, I found that the scroll bar will also continue to scroll, feeling that there is something fishy about it.
does anyone know the implementation details in this?

Feb.28,2021

that's a good question.

take a look, in fact, the principle is relatively simple, but need to deal with related events, the specific implementation is still relatively tedious.

there are a total of 5 round broadcasts. The height of each rotation is the same as that of the current page and there is a parent container on the outside. The height of the parent container is the sum of the height of the five rotation.

when not scrolling to this area, all five broadcasts use absolute positioning. Once scrolled to this area, it will switch to fixed positioning and stick to the upper edge of the browser. At the same time, the scrolling distance is calculated, and only one rotation is displayed at the same time, and it will be switched to another when it is out of one rotation area.

so the browser scroll bar we see scrolls normally, because the browser scrolls five rotational parent containers. On the other hand, the display of the five rotations is switched by setting transparency. Personally, I think this practice of transparency is not very good and will affect performance, and it may be better to use display or visibility instead.


is mainly achieved by listening for scroll bar changes.
/ / listen for scroll bar changes

window.addEventListener ('scroll', () = > {

)
        const scrollTop = window.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop;
        //scrollTopindex
    });
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1bd8f8b-53d9e.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1bd8f8b-53d9e.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?