Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

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>
Comment

PREVIOUS NEXT
Code Example
Javascript :: sample of jstree ajax call code farm 
Javascript :: guardar en una variable la peticion ajax 
Javascript :: js replace blogger thumb 
Javascript :: xrm javascript get value from form 
Javascript :: Programação web com Node e Express Beneficiando-se da stack JavaScript 
Javascript :: javascript arrays codeburst 
Javascript :: FORM EN JAVA SCRIPT 
Javascript :: how to add set between two date in datatable 
Javascript :: javascript random point on unit sphere 
Javascript :: set ibm cloud node environment variables 
Javascript :: _40 0 _55 null _65 0 _72 null react native fetch 
Javascript :: compare string camelcase and lowercase javascript 
Javascript :: document ready function is undefined 
Javascript :: express pourquoi mettre bodyparser avant router 
Javascript :: $(document).ready(function() { $(".menu-icon").on("click", function() { $("nav ul").toggleClass("showing"); }); }); 
Javascript :: scripthelpers 
Javascript :: javascript requestanimationframe stack overflow 
Javascript :: angular attach component to body 
Javascript :: angular two-way-binding on observable 
Javascript :: change abclground onload jquery 
Javascript :: how to remove &quot in json in "flutter" 
Javascript :: telegraf force_reply 
Javascript :: use vue cdn with firestore 
Javascript :: most popular company with nodejs 
Javascript :: Updating Object Properties 
Javascript :: ontouch validate angular 
Javascript :: prevent htmp injection in jsp 
Javascript :: js get lenght of h1 
Javascript :: gatsby creating pages from contentful 
Javascript :: dustjs compilator 
ADD CONTENT
Topic
Content
Source link
Name
4+9 =