jquery on scroll
Syntax
Trigger the scroll event for the selected elements:
$(selector).scroll()
Attach a function to the scroll event:
$(selector).scroll(function)
jquery on scroll
Syntax
Trigger the scroll event for the selected elements:
$(selector).scroll()
Attach a function to the scroll event:
$(selector).scroll(function)
angular scroll event on div chang width
<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>
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us