Responsive Navigation Menu Bar สวยๆ


code.gs

function doGet() {
 return HtmlService.createTemplateFromFile('index').evaluate()
 .setTitle('Responsive Navigation Menu Bar')
 .setFaviconUrl('https://www.pngall.com/wp-content/uploads/2016/05/Gold-PNG.png')
 .addMetaTag('viewport', 'width=device-width, initial-scale=1')
 .setXFrameOptionsMode(HtmlService.XFrameOptionsMode.ALLOWALL)
 .setSandboxMode(HtmlService.SandboxMode.IFRAME)
}


// function include(filename) {
//   return HtmlService.createHtmlOutputFromFile(filename)
//     .getContent();
// }
------*****
index.html
<!DOCTYPE html>
<html lang="en" dir="ltr">
  <head>
    <meta charset="utf-8">
    <title>Shiloh Church</title>
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <?!= HtmlService.createHtmlOutputFromFile('css').getContent() ?>
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.3/css/all.min.css"/>
  </head>
  <body>
    <nav>
      <input type="checkbox" id="check">
      <label for="check" class="checkbtn">
        <i class="fas fa-bars"></i>
      </label>
      <label class="logo">Shiloh Church</label>

      <ul>
        <li><a href="#" class="active tablink" onclick="openPage('Main',this)" id="defaultOpen">หน้าหลัก</a></li>
        <li><a href="#" class="tablink" onclick="openPage('Services',this)">สินค้า/บริการ</a></li>
        <li><a href="#" class="tablink" onclick="openPage('About',this)">เกี่ยวกับเรา</a></li>        
        <li><a href="#" class="tablink" onclick="openPage('Contact',this)">ติดต่อเรา</a></li>
        <li><a href="#" class="tablink" onclick="openPage('Interest',this)">น่าสนใจ</a></li>
      </ul>
    </nav>
 
   <section class="home-section">
    <div class="home-content">
    <div id="Main" class="content"> <?!= HtmlService.createHtmlOutputFromFile('Main').getContent() ?> </div>
    <div id="Services" class="content"> <?!= HtmlService.createHtmlOutputFromFile('Services').getContent() ?> </div>
    <div id="About" class="content"> <?!= HtmlService.createHtmlOutputFromFile('About').getContent() ?> </div>
    <div id="Contact" class="content"> <?!= HtmlService.createHtmlOutputFromFile('Contact').getContent() ?> </div>
    <div id="Interest" class="content"> <?!= HtmlService.createHtmlOutputFromFile('Interest').getContent() ?> </div>
   
    </div>
  </section>

     <?!= HtmlService.createHtmlOutputFromFile('javaScript').getContent() ?>

  </body>
</html>
 
***** ------------
css.html
<style>
*{
  padding: 0;
  margin: 0;
  text-decoration: none;
  list-style: none;
  box-sizing: border-box;
}
body{
  font-family: Prompt;
}
nav{
  background: #4CAD31;
  height: 80px;
  width: 100%;
}
label.logo{
  color: white;
  font-size: 35px;
  line-height: 80px;
  padding: 0 100px;
  font-weight: bold;
}
nav ul{
  float: right;
  margin-right: 20px;
}
nav ul li{
  display: inline-block;
  line-height: 80px;
  margin: 0 5px;
}
nav ul li a{
  color: white;
  font-size: 17px;
  padding: 7px 13px;
  border-radius: 3px;
  text-transform: uppercase;
}
a.active,a:hover{
  background: #1b9bff;
  transition: .5s;
}
.checkbtn{
  font-size: 30px;
  color: white;
  float: right;
  line-height: 80px;
  margin-right: 40px;
  cursor: pointer;
  display: none;
}
#check{
  display: none;
}
@media (max-width: 952px){
  label.logo{
    font-size: 30px;
    padding-left: 50px;
  }
  nav ul li a{
    font-size: 16px;
  }
}
@media (max-width: 858px){
  .checkbtn{
    display: block;
  }
  ul{
    position: fixed;
    width: 100%;
    height: 100vh;
    background: #2c3e50;
    top: 80px;
    left: -100%;
    text-align: center;
    transition: all .5s;
  }
  nav ul li{
    display: block;
    margin: 50px 0;
    line-height: 30px;
  }
  nav ul li a{
    font-size: 20px;
  }
  a:hover,a.active{
    background: none;
    color: #0082e6;
  }
  #check:checked ~ ul{
    left: 0;
  }
}
section{
  background: url(https://images.unsplash.com/photo-1621506289937-a8e4df240d0b?ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D&auto=format&fit=crop&w=1374&q=80) no-repeat;
  background-size: cover;
  height: calc(100vh - 80px);
}
</style>
------********------- 
 About.html
 
<!DOCTYPE html>
<html>
  <head>
    <base target="_top">
  </head>
  <body>
    <iframe src="https://shilohthaichurch.blogspot.com/"height="700" width=100%  title="คริสตจักร ชิโลห์ ประเทศไทย"></iframe>
  </body>
</html>
 
----------*******--------
Services.html
<iframe src="https://script.google.com/macros/s/AKfycbw_WmEYztjZ24-EKj_VKaZ_OS4SNOHnUTgD97a8eu_glfByscOPKebK6fZq6eoQ8QaQ/exec" height="700" width=100% title="ลงทะเบียนผู้ขอรับทุนการศึกษา สมาคมฌาปนกิจสงเคราะห์ โกเชน"></iframe>
 
 ----------*******--------
 
 
Contact.html
 
<!DOCTYPE html>
<html>
  <head>
    <base target="_top">
  </head>
  <body>
    <iframe src="https://goshencremation.wordpress.com/"height="700" width=100%  title=""></iframe>
  </body>
</html>

----------*******--------
 Interest.html
<!DOCTYPE html>
<html>
  <head>
    <base target="_top">
  </head>
  <body>
    <iframe src="https://shilohorganicfoodcommunityenterprise.wordpress.com/"height="700" width=100%  title=""></iframe>  
  </body>
</html>

----------*******--------
 
 Main.html
 
<!DOCTYPE html>
<html>
  <head>
    <base target="_top">
  </head>
  <body>
   
 </body>
</html>

----------*******--------
javaScript.html
 
<script>
  function openPage(pageName,elmnt) {
  var i, content;
  content = document.getElementsByClassName("content");
  for (i = 0; i < content.length; i++) {
    content[i].style.display = "none";
  }
  document.getElementById(pageName).style.display = "block";
    event.preventDefault();
  // document.getElementById(check).click();

}
document.getElementById("defaultOpen").click();
</script>



 
 
 
 
 

ไม่มีความคิดเห็น:

แสดงความคิดเห็น

หมายเหตุ: มีเพียงสมาชิกของบล็อกนี้เท่านั้นที่สามารถแสดงความคิดเห็น