လုပ်နည်း - Scroll တွင် Menu ကိုဖျောက်ပါ။
CSS နှင့် JavaScript ဖြင့် အောက်သို့ဆင်းကာ လမ်းကြောင်းပြမီနူးကို ဝှက်နည်းကို လေ့လာပါ။
Scroll Down တွင် Navbar ကို ဖျောက်နည်း
အဆင့် 1) HTML ကိုထည့်ပါ
လမ်းညွှန်ဘားတစ်ခု ဖန်တီးပါ-
ဥပမာ
<div id="navbar">
<a href="#home">Home</a>
<a href="#news">News</a>
<a href="#contact">Contact</a>
</div>
အဆင့် 2) CSS ကိုထည့်ပါ
လမ်းညွှန်ဘားကို ပုံစံထုတ်ပါ-
ဥပမာ
#navbar {
background-color: #333; /* Black background
color */
position: fixed; /* Make it stick/fixed
*/
top: 0; /* Stay on top */
width: 100%; /* Full width */
transition: top 0.3s; /* Transition effect when sliding down (and up) */
}
/* Style the navbar links */
#navbar a {
float: left;
display: block;
color: white;
text-align: center;
padding: 15px;
text-decoration: none;
}
#navbar
a:hover {
background-color: #ddd;
color: black;
}
အဆင့် 3) JavaScript ကိုထည့်ပါ။
ဥပမာ
/* When the user scrolls down, hide the navbar. When the user scrolls up, show
the navbar */
var prevScrollpos = window.pageYOffset;
window.onscroll =
function() {
var currentScrollPos = window.pageYOffset;
if
(prevScrollpos > currentScrollPos) {
document.getElementById("navbar").style.top = "0";
} else {
document.getElementById("navbar").style.top = "-50px";
}
prevScrollpos = currentScrollPos;
}