Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixed the navbar issue #46

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 45 additions & 2 deletions css/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -590,9 +590,45 @@ body{
.nav-link{
padding-right: 1.5rem !important;
}
.navbar{
/* background-color: #121c40; */
/* background: transparent; */
}

.menu-container{
margin-left: auto;
width: 1rem;
cursor: pointer;
}

.menu-img{
width: 100%;
object-fit: contain;
}

@media(max-width:568px){
.navbar-nav{display:none}
@media(max-width:992px){
.navbarSupportedContent{
transform: translateX(-100vh);
position: absolute;
background: #FFF;
transition: all 1s ease;
width: 100vh;
top: 5vh;
z-index: 101;
padding-left: 2rem;
}
.navbar{
background-color: #121c40;
}
.active{
/* background-color: #121c40; */
transform: translateX(0vh);
}
}
@media(min-width:992px){
.menu-container{
display: none;
}
}

@media(min-width:568px){
Expand Down Expand Up @@ -647,4 +683,11 @@ body{
}
.project-description ul li{
display: list-item;
}
@media(max-width: 768px){
.project{
width: 100%;
}
}) {

}
Binary file added img/menu.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
21 changes: 20 additions & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@

<body>
<nav class="navbar navbar-expand-lg navbar-light info-color">
<div class="collapse navbar-collapse" id="navbarSupportedContent">
<div class="navbar-collapse navbarSupportedContent"

>
<ul class="navbar-nav mr-auto">
<li class="nav-item">
<a class="nav-link waves-effect waves-light" href="#products">Products</a>
Expand All @@ -32,6 +34,10 @@
</li>
</ul>
</div>
<div class="menu-container" onclick="handleclick">
<img src="img/menu.png" alt="menu" class="menu-img" >
</div>

</nav>

<a href="#" id="back-to-top" title="Back to top">&uarr;</a>
Expand Down Expand Up @@ -171,6 +177,19 @@ <h1 class="testimonials-text" align="center">Awesome Community</h1>
</footer>
<script src="https://code.jquery.com/jquery-1.12.4.min.js"></script>
<script>
const menu_div = document.getElementsByClassName("menu-container");
const menu = document.getElementsByClassName("navbarSupportedContent");
function handleclick() {
console.log("1");
console.log(menu.classList);
if(menu[0].classList.contains("active")){
menu[0].classList.remove("active");
}
else{
menu[0].classList.add("active");
}
}
menu_div[0].addEventListener("click", handleclick);
if ($('#back-to-top').length) {
var scrollTrigger = 100, // px
backToTop = function () {
Expand Down