Hacker News new | past | comments | ask | show | jobs | submit login

So I tried but the results were... um, unexpected: 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)+')'}



That looks like it would be a good April Fool's Day prank.


It 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.


This 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".




Join us for AI Startup School this June 16-17 in San Francisco!

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: