I use a library called FullPage.js (https://github.com/alvarotrigo/react-fullpage) in my Next.js project. They have an existing CSS class that I want to override for the side points. However, I only want to rewrite the CSS for one page, and it's the following CSS selector. How do I do this?
Thank you in advance for your help!
global.css
#fp-nav > ul > li:last-child > a { display:none }
Page1.jsx
import ReactDOM from "react-dom"; import "fullpage.js/vendors/scrolloverflow"; // 可选项。当使用scrollOverflow:true时 import ReactFullpage from "@fullpage/react-fullpage"; import "./global.css"; class MySection extends React.Component { render() { return ( <div className="section"> <h3>{this.props.content}</h3> </div> ); } } const Page1 = () => ( <ReactFullpage navigation sectionsColor={["#282c34", "#ff5f45", "#0798ec"]} render={({ state, fullpageApi }) => { return ( <div> <MySection content={"从第一页滑下来!"} /> <MySection content={"继续前进!从第一页"} /> <MySection content={"从第一页滑上去!"} /> </div> ); }} /> ); export default Page1;
Page2.jsx
import ReactDOM from "react-dom"; import "fullpage.js/vendors/scrolloverflow"; // 可选项。当使用scrollOverflow:true时 import ReactFullpage from "@fullpage/react-fullpage"; import "./global.css"; class MySection extends React.Component { render() { return ( <div className="section"> <h3>{this.props.content}</h3> </div> ); } } const Page2 = () => ( <ReactFullpage navigation sectionsColor={["#282c34", "#ff5f45", "#0798ec"]} render={({ state, fullpageApi }) => { return ( <div> <MySection content={"从第二页滑下来!"} /> <MySection content={"继续前进!从第二页"} /> <MySection content={"从第二页滑上去!"} /> </div> ); }} /> ); export default Page2;
I found an answer,
I just added a query selector with DOM in useEffect()
Look at the code below