LATEST >>

Welcome Here And Thanks For Visiting. Like Us On Facebook...

EXEIdeas – Let's Your Mind Rock » HTML-CSS-PHP-JavaScript / JavaScript Codes » Stylish Bottom Navigation Bar Using HTML CSS & JavaScript

Stylish Bottom Navigation Bar Using HTML CSS & JavaScript

Stylish-Bottom-Navigation-Bar-Using-HTML-CSS-&-JavaScript
Whenever you hear of “mobile navigation”, what’s the first thing that comes to mind? My guess would be the hamburger slide-out menu. This design pattern had been in use since the first responsive design days, and even though a lot has changed since then, this particular pattern has not. Why is that?

Nowadays, stylish bottom menus are in fashion in new web design and template to make it looks like a mobile app when user will open the web in mobile.

There are many code snippets available online or on many other blogs and websites, but everyone cannot optimize your blog or website, so you need some optimized code snippets. So now checkout out the code snippet for your blog and website that will give you all features for your desired code. Now grab the ready-to-use code and paste it where you want.

Features:

  1. Light Weight.
  2. Pure HTML-CSS-JSCode.
  3. Cross Browser.
  4. No JQuery Files.
  5. Fully Customizable.
  6. Responsive.

How To Create Pure HTML5 Collapsible Accordion Multi-Tabs Without CSS And JavaScript?

There are a few easy and understandable steps to achieve your desired functionality that we are gonna share below. Follow each step perfectly.

Recommended For You:
How To Copy Text From A Div And Paste It Into A TextArea Using JavaScript?

CSS:

<style type="text/css">
@import url("https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.4/css/all.min.css");
:root {
--main-color: #ff767d;
--second-color: #acb8c1;
}

* {
margin: 0;
padding: 0;
box-sizing: border-box;
}

body {
min-height: 100vh;
background-color: #f2f2f2;

display: flex;
align-items: center;
justify-content: center;
}

.navigation-bar {
background: #fff;
border-radius: 3px;
overflow: hidden;
box-shadow: 0 15px 25px rgba(0, 0, 0, 0.1);
}
.navigation-bar .list-items {
list-style: none;
display: flex;
position: relative;
}
.navigation-bar .list-items .pointer {
position: absolute;
left: 0px;
height: 100%;
width: 4.5rem;
z-index: 0;
transition: all 0.2s linear;
}
.navigation-bar .list-items .pointer::before,
.navigation-bar .list-items .pointer::after {
content: "";
position: absolute;
left: 0;
width: 100%;
}
.navigation-bar .list-items .pointer::before {
top: 0;
border-bottom: 8px solid var(--main-color);
border-radius: 0 0 30px 30px;
}
.navigation-bar .list-items .pointer::after {
bottom: 0;
border-top: 8px solid var(--main-color);
border-radius: 30px 30px 0 0;
}

.navigation-bar .list-items .item {
flex: 1 1 0px;
position: relative;
z-index: 2;
}
.navigation-bar .list-items .item .link {
display: inline-block;
height: 4rem;
width: 4.5rem;
line-height: 4.5;
text-align: center;
color: var(--second-color);
}
.navigation-bar .list-items .item.active .link {
color: var(--main-color);
}
.navigation-bar .list-items .item .link i {
font-size: 1.6rem;
transition: font-size 0.2s linear;
}
.navigation-bar .list-items .item.active .link i {
font-size: 1.4rem;
}

</style>

HTML:

<nav class="navigation-bar">
<ul class="list-items">
<span class="pointer"></span>
<li class="item active">
<a class="link" href="#">
<i class="fas fa-home fa-2x"></i>
</a>
</li>
<li class="item">
<a class="link" href="#">
<i class="fas fa-search fa-2x"></i>
</a>
</li>
<li class="item">
<a class="link" href="#">
<i class="fas fa-heart fa-2x"></i>
</a>
</li>
<li class="item">
<a class="link" href="#">
<i class="fas fa-bell fa-2x"></i>
</a>
</li>
<li class="item">
<a class="link" href="#">
<i class="fas fa-user fa-2x"></i>
</a>
</li>
</ul>
</nav>

JavaScript:

<script type="text/javascript">
const navigation_items_elms = document.querySelectorAll(
".navigation-bar .list-items .item"
);
const navigation_pointer = document.querySelector(".navigation-bar .pointer");

navigation_items_elms.forEach((item, index) => {
item.addEventListener("click", (e) => {
e.preventDefault();
navigation_items_elms.forEach((itm) => itm.classList.remove("active"));
item.classList.add("active");

const parentWidth = item.parentElement.clientWidth;
const lefPercent = (parentWidth / navigation_items_elms.length) * index;
navigation_pointer.style.left = lefPercent + "px";
});
});
</script>

Customization:

No need to customize it. Just copy-paste. Rest edit the code as per comments and need.

Troubleshooting the Errors:

Do it with concentration and patience. Check your all steps again and all codes or scripts. If you find any error you can contact us anytime via comment or better via email, We are always here to help you.

Recommended For You:
How To Add/Create A QR Code Reader On Your Website Using JavaScript?

Final Words:

That’s all we have. We hope that you liked this article. If you have any problem with this code in your template then feel free to contact us with a full explanation of your problem. We will reply to you as time allows us If you have any doubts or problems please comment below. We are happy to help you! If you liked this article, Don’t forget to share this with your friends so they can also take benefit from it and leave.

You Like It, Please Share This Recipe With Your Friends Using...

Be the first to write a comment.

Leave a Reply

Your email address will not be published. Required fields are marked *