score:0
Accepted answer
i would get the scrolling element from the event
that get's passed into your listenscroll
function.
listenscroll = (event) => {
if(event.target.scrollingelement.scrolltop) {
this.setstate({ changecolor: "transparent" });
} else {
this.setstate({ changecolor: "red" });
}
}
working example here: https://jsfiddle.net/dotspencer/mf93wexn/11/
Source: stackoverflow.com
Related Query
- Change navbar color depending on scrollbar position
- ReactJS change color of element on scroll and when certain position is reached
- Change color and position of CircularProgress?
- It is possible to change the text color depending on the value? (React native)
- ReactJS Change Navbar color based on scroll to section with dynamic height
- AgGrid: How to blink cell in different color depending on change
- How to change navbar background color in react when I scroll
- how to change the line color in the NavBar toggle button in react-bootstrap?
- change color depending on value with javascript
- ReactJS change the background color of the selected Navlink in a react bootstrap navbar
- How To Change Color Of <td> element depending on value
- How to change the backgroundand text color of the navbar on scroll in react.js?
- Next.js: Change Div color of header depending on active pgae
- Change color of a TreeNode depending on some condition; using tree from antd React Library
- Change color palette depending on variable in SCSS
- How to make logo appear on navbar depending on width change in React?
- Change scrollbar position without changing text direction
- where to place componentDidMount in order to change link Navbar color while scrolling in React / Gatsby?
- How to change Bootstrap navbar color on scroll in React.js?
- How to change background color in paragraph depending on the value in reactjs
- How to change background color in paragraph depending on the values reactjs
- How to change button color depending on array element in ReactJS
- How to change link Navbar color while scrolling in React or Gatsby?
- Change navbar background color on other routes in ReactJS
- ReactJS - Change navbar color on scroll
- How can I change the color of the active navbar item?
- React: How to change position of footer component depending on route
- Why main scrollbar color doesn't change in Firefox?
- How to change colour and position of Navbar using useEffect and useState?
- How to change background color of a toast depending on theme? react-toastify
More Query from same tag
- useState vs useReducer
- Could the Delete modal be getting hijacked by React-Router?
- React-Router location with multiple search parameters
- Is there any way to trigger a react-select dropdown with jquery from browser?
- Show or hide a React component rendered from an array, only a specific one
- ReactJS: Large app with Nested components
- Why Reactjs application considers css files type as 'text/html'
- How to correctly assign axios response to react function component state
- process.node.env is undefined in eslintrc.js
- How to add another table row on click in react app using typescript
- Creating static link for assets in React JS
- React component render after event listener
- Creating Tweet Display Box in ReactJS
- Material Ui popover is not on right position
- Unable to display icon in React Bootstrap Tab instead of text
- React : Rendering a syntax highlighted code block
- Best way to use Mongoose to update an Array of Objects?
- How can I dynamically render components when enter an input
- Ref on svg <path /> doesn't have "getTotalLength()"-Method
- How to customise react / next.js input placeholders
- Focus on last item every time a prop is updated
- React js Semantic Menu items on center
- Mapping over array returns [object Object]
- Can't redirect using props.history.push with react-router
- How to get the value of input tag onSubmit without using onChange in React js/Typescript?
- Typescript always throws a warning for this hook
- React: Passing a template literal as a prop
- Mapping data from mongoDB to Mat UI DataGrid
- How to embede Apache Superset chart into React app
- Always show "X" on Autocomplete to delete content