လုပ်နည်း - မျက်နှာပြင်အပြည့် ထပ်ဆင့်လမ်းညွှန်ခြင်း။
မျက်နှာပြင်အပြည့် ထပ်ဆင့်လမ်းညွှန်မှုမီနူးကို ဖန်တီးနည်းကို လေ့လာပါ။
၎င်းအလုပ်လုပ်ပုံကိုကြည့်ရန် အောက်ပါခလုတ်များကို နှိပ်ပါ။
မျက်နှာပြင်အပြည့် ထပ်ဆင့်လမ်းညွှန်မှု ဖန်တီးပါ။
အဆင့် 1) HTML ကိုထည့်ပါ
ဥပမာ
<!-- The overlay -->
<div id="myNav" class="overlay">
<!-- Button to close the overlay navigation -->
<a href="#"
class="closebtn" onclick="closeNav()">×</a>
<!-- Overlay content -->
<div
class="overlay-content">
<a href="#">About</a>
<a href="#">Services</a>
<a href="#">Clients</a>
<a href="#">Contact</a>
</div>
</div>
<!-- Use any element to open/show the overlay navigation menu -->
<span onclick="openNav()">open</span>
အဆင့် 2) CSS ကိုထည့်ပါ
ဥပမာ
/* The Overlay (background) */
.overlay {
/* Height
& width depends on how you want to reveal the overlay (see JS below) */
height: 100%;
width: 0;
position: fixed; /* Stay in place */
z-index: 1; /*
Sit on top */
left: 0;
top: 0;
background-color: rgb(0,0,0); /* Black fallback color */
background-color: rgba(0,0,0, 0.9); /* Black w/opacity */
overflow-x: hidden; /* Disable horizontal scroll */
transition: 0.5s; /* 0.5 second transition effect to slide in or slide down
the overlay (height or width, depending on reveal) */
}
/* Position the content inside the overlay */
.overlay-content {
position: relative;
top: 25%; /* 25% from the top */
width: 100%; /* 100% width */
text-align: center; /*
Centered text/links */
margin-top: 30px; /* 30px top
margin to avoid conflict with the close button on smaller screens */
}
/* The navigation links inside the overlay */
.overlay a {
padding: 8px;
text-decoration: none;
font-size: 36px;
color: #818181;
display: block; /* Display block
instead of inline */
transition: 0.3s; /* Transition
effects on hover (color) */
}
/*
When you mouse over the navigation links, change their color */
.overlay
a:hover, .overlay a:focus {
color:
#f1f1f1;
}
/* Position the close button (top right corner) */
.overlay .closebtn {
position:
absolute;
top: 20px;
right:
45px;
font-size: 60px;
}
/* When the height of the screen is less than 450 pixels, change the
font-size of the links and position the close button again, so they don't
overlap */
@media screen and (max-height: 450px) {
.overlay a {font-size: 20px}
.overlay .closebtn {
font-size: 40px;
top: 15px;
right: 35px;
}
}
အဆင့် 3) JavaScript ကိုထည့်ပါ။
အောက်ဖော်ပြပါ ဥပမာသည် ထပ်ဆင့်လမ်းညွှန်မီနူးတွင် ဘယ်မှညာသို့ (0 မှ 100% အကျယ်) ကို အစပျိုးသောအခါ-
ဘေးကနေ တွန်းဝင်ပါ။
/* Open
when someone clicks on the span element */
function openNav() {
document.getElementById("myNav").style.width
= "100%";
}
/* Close when someone clicks on the "x"
symbol inside the overlay */
function closeNav() {
document.getElementById("myNav").style.width = "0%";
}
အောက်ဖော်ပြပါ ဥပမာသည် အပေါ်မှ အောက်ထပ် လမ်းကြောင်းပြမီနူး (0 မှ 100% အမြင့်) တွင် ဆလိုက်ရှိသည်။
မှတ်ချက်- ဤဥပမာတွင်၊ CSS သည် အထက်ဖော်ပြပါတစ်ခုနှင့် အနည်းငယ်ကွာခြားသည်ကို သတိပြုပါ (မူရင်းအမြင့်သည် ယခုအခါ 0 ဖြစ်ပြီး၊ အကျယ်သည် 100% ရှိပြီး overflow-y ကို ဝှက်ထားသည် (ဒေါင်လိုက်၊ သေးငယ်သောစခရင်များမှလွဲ၍) ရွှေ့ခြင်းကို ပိတ်ပါ))။
အပေါ်ကနေ အောက်ကို ပွတ်ပါ။
/* Open */
function openNav() {
document.getElementById("myNav").style.height
= "100%";
}
/* Close */
function closeNav() {
document.getElementById("myNav").style.height = "0%";
}
ဤဥပမာသည် ကာတွန်းမပါဘဲ လမ်းညွှန်ချက်မီနူးကို ဖွင့်သည်-
ကာတွန်းမပါဘဲ မီနူးကို ဖွင့်ပါ။
/* Open */
function openNav() {
document.getElementById("myNav").style.display
= "block";
}
/* Close */
function closeNav() {
document.getElementById("myNav").style.display = "none";
}
အကြံပြုချက်- လမ်းပြဘားများအကြောင်း ပိုမိုလေ့လာရန် ကျွန်ုပ်တို့၏ CSS Navbar Tutorial သို့ သွားပါ ။
W3Schools Spaces အကြောင်း ကြားဖူး ပါသလား။ ဤနေရာတွင် သင်သည် သင့်ဝဘ်ဆိုဒ်ကို အစမှအဆုံး ဖန်တီးနိုင်သည် သို့မဟုတ် နမူနာပုံစံတစ်ခုကို အသုံးပြုကာ ၎င်းကို အခမဲ့ လက်ခံဆောင်ရွက်ပေးနိုင်သည်။
❯ အခမဲ့ စတင်လိုက်ပါ။* ခရက်ဒစ်ကတ်မလိုအပ်ပါ။