Acara Gulir Angular pada Lebar Div Chang
<body style="overflow: scroll; height: 1000px;" onload="scrollDetect()">
<div class="firstdiv" style="border:1px solid black; margin: 0 auto; width: 200px;height: 200px;">
</div>
<script>
function scrollDetect() {
let div = document.querySelector('.firstdiv')
var lastScroll = 0;
window.onscroll = function () {
let currentScroll = document.documentElement.scrollTop; // Get Current Scroll Value
if (currentScroll > 0 && lastScroll <= currentScroll) {
lastScroll = currentScroll;
div.style.width = '50%'
div.style.height = "50%";
div.style.background = "red";
div.style.position = "relative";
div.style.top = "0";
div.style.left = "0";
} else {
lastScroll = currentScroll;
div.style.width = '200px'
div.style.height = '200px'
}
};
}
</script>
</body>
Upset Unicorn