samedi 28 août 2021

i have been trying to make it so that if user scrolls they will get scrolled to a specific position using jquery

The scroll into view and if statement to read user scroll is working individually but can get them to work together

    <script type="text/javascript">
$(window).bind('mousewheel', function(event) {
         if (event.originalEvent.wheelDelta >= 0) {
            console.log('Scroll up');
            window.scrollTo(0,0);
        }
        else{
        document.querySelector('#PROJECTS-2').scrollIntoView();
    }}
    </script>



Aucun commentaire:

Enregistrer un commentaire