问题描述
我希望导航栏固定在顶部。我在导航栏中使用了引导程序类“固定顶部”,但问题是它一开始就将我的内容隐藏在导航栏中。我希望导航栏在开始时不滚动后才开始隐藏内容。谁能帮助我。 React Header组件已附加。 我想要这样的网站 lameccanica.it
import React from "react";
import {
Mdbnavbar,MdbnavbarBrand,MdbnavbarNav,MdbnavItem,MdbnavLink,MdbnavbarToggler,MDBCollapse,MDBDropdown,MDBDropdownToggle,MDBDropdownMenu,MDBDropdownItem,} from "mdbreact";
import { Link } from "react-router-dom";
import "../css/header.css";
import logo from "../images/logo.png";
const Header = () => {
const [isOpen,setIsOpen] = React.useState(false);
const toggleCollapse = () => {
setIsOpen(!isOpen);
};
return (
<div>
<Mdbnavbar
color="white"
light
expand="md"
className="text-dark shadow-sm fixed-top"
>
<MdbnavbarBrand>
<img
src={logo}
className="rounded float-left ml-5"
alt="logo"
width="100px"
/>
</MdbnavbarBrand>
<MdbnavbarToggler onClick={toggleCollapse} />
<MDBCollapse id="navbarCollapse3" isOpen={isOpen} navbar>
<MdbnavbarNav right className="font-weight-bold">
<MdbnavItem className="px-5 ">
<MdbnavLink to="/home">Home</MdbnavLink>
</MdbnavItem>
<MdbnavItem className="px-5">
<MDBDropdown>
<MDBDropdownToggle nav caret>
<span>Sectors</span>
</MDBDropdownToggle>
<MDBDropdownMenu className="special-color-dark">
<MDBDropdownItem className="dropdown-item">
<Link
className="text-white"
to="/sectors/animal-Feed"
>
Animal Feed
</Link>
</MDBDropdownItem>
<MDBDropdownItem>
<Link
className="text-white"
to="/sectors/wood-biomass"
>
Wood & Biomass
</Link>
</MDBDropdownItem>
<MDBDropdownItem>
<Link
className="text-white"
to="/sectors/fertilizers"
>
Fertilizers
</Link>
</MDBDropdownItem>
<MDBDropdownItem>
<Link
className="text-white"
to="/sectors/recycling"
>
Recycling
</Link>
</MDBDropdownItem>
<MDBDropdownItem>
<Link
className="text-white"
to="/sectors/dies-rolls"
>
Dies & Rolls
</Link>
</MDBDropdownItem>
</MDBDropdownMenu>
</MDBDropdown>
</MdbnavItem>
<MdbnavItem className="px-5">
<MdbnavLink to="/contact-us">Contact Us</MdbnavLink>
</MdbnavItem>
<MdbnavItem className="px-5 mr-4">
<MdbnavLink to="/about-us">About Us</MdbnavLink>
</MdbnavItem>
</MdbnavbarNav>
</MDBCollapse>
</Mdbnavbar>
</div>
);
};
export default Header;
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)