score:0
window.scrolly
will give you the amount of your page scroll, you can get these values and then do some calculation on them to reach your expectation.
you can implement them in another useeffect
hook to control your scroll amount and then trigger a listener or remove them on reaching it:
useeffect(() => {
if(window.scrolly > document.body.offsetheight) {
// now you can remove your listener
}
}, [])
note 1: document.body.offsetheight
is your whole page size that the user sees without any scroll.
note 2: that you can do simple calculations with these parameters to reach your desire behavior.
note 3: in this pseudo code, useeffect
will be triggered after every page size change and every scroll, because of its array of dependencies.
to prevent or enhance this you can create a variable for your window's actual size and then pass it to use useeffect
dependencies array to trigger it by your desire.
Source: stackoverflow.com
Related Query
- How to disable scroll when reaches n% bottom?
- How to disable scroll parent component when child page (popup page) is opened? - CSS
- How to make a div scroll to the bottom of its container then scroll back up when it's done in React?
- How to scroll to bottom when props changed in react-virtualized?
- how to scroll div to bottom zero when new message pop ups in react js
- How to scroll to bottom in react?
- How to disable a button when an input is empty?
- How to keep scroll position using flatlist when navigating back in react native ?
- ReactJS how to render a component only when scroll down and reach it on the page?
- Maintaining scroll position only works when not near the bottom of messages div
- How to scroll a React page when it loads?
- How to disable the selection of an item when the first letter of the option is pressed in the Select component?
- react-scroll | How to scroll to a specific targeted component when clicking on Navbar Link
- javascript - How to start update scroll percentage when element is on the top of viewport
- how to disable rtl when phone language changes?
- How to scroll to text input on focus when there is an input accessory with React Native
- How to update list of items with Infinite scroll when new item added
- How to scroll at bottom in react on button
- Two divs scroll simultaneously until one reaches bottom
- How to disable click on <div> when <button> in <div> is clicked
- how to Show or hide Navbar when scroll use react.js?
- Scroll to bottom of the page when data added in body dynamically in react js?
- How can I scroll to a page when doing React Router history push in my case
- How to check if scroll is near the bottom
- How to set modal scroll to top when it appears in React.js
- Use animation to smoothly display hidden button when hitting bottom of scroll
- How to determine how much user will scroll by pixels when user start scrolling using mouse wheel in Javascript
- How to change navbar background color in react when I scroll
- React.js - Disable background scroll when a modal is showing
- How to disable dropdown when a specific option is selected in React?
More Query from same tag
- React Firebase Sign In With Google
- add and execute scripts react-testing-library and jest
- How to validate material-ui-phone-number with Yup
- Fetch data from mongodb with react and axios
- Sending row/cell data on click to the function - ReactJS
- React: close other SubMenus when another SubMenu open
- Refreshing chart after submitting a new task
- Shallow rendering a component which depends on TweenLite
- Property does not exist on type 'Readonly<{}> & Readonly<{ children?: ReactNode; }>'. TS2339
- React antd steps re-render child component to parent state change
- Using apollo and graphql higher order component to paginate data
- Svg renders at a different pixel count than specified
- Redux - Combining multiple reducers result in state clearing
- Could not find a declaration file for module in React Js
- Can't get offsetHeight from React Ref
- ChakraUI useColorModeValue not updating main box color
- React App Login Error : Maximum update depth exceeded
- Get the first value from api request in React JS
- Formik validation isSubmitting / isValidating not getting set to true
- Rendering an SVG element from NodeJS in React
- Does selectedMenuItemStyle in material-ui work?
- Dynamic importing a library next.js
- Playing audio with setInterval in ts/js & electron
- React with Typescript | Functional component | Type 'boolean' is not assignable to type 'ReactElement<any, any>'
- Render JSX elements within a function
- history.push and state resetting
- How do I programaticly navigate to a route from an event handler in React Router 4.0?
- How to re-render a react component after returning something in a function?
- React open full picture onClick
- How to define the type of the Input component ref after the React.forwardRef forwards the ref?