4 ms·
I want to emulate that behavior somehow.
by tekromancr 9y ago
I want to emulate that behavior somehow.
- deleted 9y ago[deleted]
- sgentle 9y agoSo I tried but the results were... um, unexpected: https://gfycat.com/negligiblesnivelingastarte https://gfycat.com/negligiblesnivelingastarte Code: var db = document.body;document.onscroll = function(){db.style.transform = 'scaleY(1)'; db.style.transform = 'scaleY('+db.scrollHeight / (db.scrollHeight - db.scrollTop)+')'}
- Casseres 9y agoThat looks like it would be a good April Fool's Day prank.
- nWjbyf45T 9y agoIt seems from the code you first stretch it out to Infinity and then when scrollTop is bigger than scrollHeight, you go from negative Infinity back to 1. Negative values of scale() 'mirrors' the element. Maybe make sure scrollTop is never equal to or bigger than scrollHeight.
- daxterspeed 9y agoThis result is by itself amazing, but if you want to make it behave a bit more like the bug you can set the transform-origin to "center bottom".