The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums JavaScript Scrolling on keypress, need to limit the number of times it fires

  • This topic is empty.
Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
  • #44793

    Hey, I am making a single page website which is similar to [this]( site. I have achieved the scroll on keypress using jQuery and scrollTop() function.
    Although if you scroll the website mentioned in the link with your arrow keys you will see that after on keypress another keypress is not registered till the scroll is completed.
    In my site it scrolls every time the arrow key is pressed. How can I achieve the scrolling as above


    What I think you are asking is “how do I stop keyboard interaction during the scroll”…No?


    @Paulie_D Exactly…yes


    With a lock on interaction during scrolling, set a var to false when scrolling starts and true when scrolling ends and only scroll on keypress if the var is true. If you need more help make a CodePen with what you have so far.

Viewing 4 posts - 1 through 4 (of 4 total)
  • The forum ‘JavaScript’ is closed to new topics and replies.