How to realize horizontal sliding Navigation Bar by html5
This article mainly shows you "html5 how to achieve horizontal sliding navigation bar", the content is easy to understand, clear, hope to help you solve your doubts, the following let the editor lead you to study and learn "how to achieve horizontal sliding navigation bar html5" this article.
1. Introduce scroll.js first.
2. Html part:
All Mathematics, English, Chinese and Physics thoughts and morals
3. Css part
/ * sliding navigation * / .nav li {float: left; min-width: 60px; padding: 5px 0; margin-right: 9px;} .nav a {font-size: 14px; color: # 999;} .navMain {background-color: # fff; position: relative; margin: 013px;} .nav {background-color: # fff; overflow: hidden;}. Nav li > a.active {color: # 3a95f5 Border-bottom: 1px solid # 3a95f5; padding-bottom: 2px;}
4. Js part
$(".nav li a") .click (function () {$(this) .addClass ("active"). Parents ("li"). Siblings (). Find ("a"). RemoveClass ("active");}) Window.addEventListener ('load',function () {var $navBox = document.getElementById (' navBox'), $ul = $navBox.querySelector ('ul'), liArray = $navBox.querySelectorAll (' li'), liLength = $navBox.querySelectorAll ('li'). Length;10$ ul.style.width = (liArray [0] .clientWidth + 10) * liLength + "px"; var carousel=new iScroll ("carousel", {hScrollbar:false, vScrollbar:false, vScroll: false});}) The above is all the content of the article "how to slide the navigation bar horizontally in html5". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!