Membuat Sidebar Responsive Tanpa Bootstrap

Membuat Sidebar Responsive Tanpa BootstrapHari sudah mulai sore, hari ini saya ingin membagikan artikel mengenai membuat sidebar responsive tanpa bootstrap. Yang dibutuhkan hanaya librari jquery,hehehe. Giman,menarik bukan. Tanpa basi basi dan panjang lebar, langsung saja kita mulai.
Lanhkah pertama buatlah folder dahulu, isi dari folder adalah file index.html, custom.css serta jquery. Jika teman teman belum punya librari javascrip yang berupa jquery, silahkkan download terlebih dahulu. Langkah kedua isikan file index.html dengan sourcecode berikut


<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<title>kiblatwebsite.blogspot.co.id</title>
    <link rel="stylesheet" type="text/css" href="custom.css">
    <script type="text/javascript" src="jquery-3.2.1.min.js"></script>
<script type="text/javascript"> 
$(document).ready(function(){
$("#btn-menu").click(function(){
$(".header").toggleClass('slideheader');
$(".sidebar").toggleClass('slidesidebar');
$(".section").toggleClass('slidesection');
});
    });
</script>
 </head>
<body>
<div class="wrapper">
<div class="header">
<a id="btn-menu" href="#"><<</a>
</div>
  <div class="sidebar">
  <div class="sidebar-title"><b>Pro</b>ject</div>
  <ul>
  <li><a href="#">Menu 1</a></li>
  <li><a href="#">Menu 2</a></li>
  <li><a href="#">Menu 3</a></li>
  <li><a href="#">Menu 4</a></li>
  <li><a href="#">Menu 5</a></li>
  <li><a href="#">Menu 6</a></li>
  </ul>
  </div>
  <div class="section">
<h2>Lorem Ipsum is simply</h2>
Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.
<h2>Lorem Ipsum is simply</h2>
Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.
<h2>Lorem Ipsum is simply</h2>
Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.
<h2>Lorem Ipsum is simply</h2>
Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum. <h2>Lorem Ipsum is simply</h2>
Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.
<h2>Lorem Ipsum is simply</h2>
Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.
  </div>
  </div>
</body>
</html>

Sedangkan untuk custom.css isikan dengan sourcecode berikut

body{
padding: 0px;
margin:0px; 
font-family: arial;
}
.sidebar{
width: 200px;
background: #3b4a59;
  position: fixed;
left: 0;
bottom:0;
top: 0;
transition: 1s;
z-index: 1;
  }
.sidebar-title{
color: #fff;
  text-align: center;
line-height: 50px;
background:#3a93a7; 
}
.sidebar ul{
margin-top: 1px;
}

.sidebar ul li{
  list-style: none;
}
.sidebar ul li a{
  text-decoration:none;  
color: #fff;
  padding: 20px;
  display: block;
  margin-left: -40px;
  border-bottom: 1px solid #364554;
 }
.sidebar ul li a:hover{
background: #465869;
 }
.sidebar ul li a:active,.sidebar ul li a:visited{
background: #2c3843;
 }
.section{
position: relative;
  width: auto;
  transition: 1s;
  padding: 10px 10px 10px 210px;

}
.header{
line-height: 48px;
background:#3a93a7;
  padding: 0px 0px 0px 200px;
transition: 1s;
}
.slidesidebar{
margin-left: -200px;
transition: 1s;
 }
.slidesection,.slideheader{
margin-left: -200px;
transition: 1s;
}
#btn-menu{
background:#348496;
color: #fff;
padding: 14px;
font-size: 22px;
  text-decoration:none; 
}
#btn-menu:hover{
background: #348496;
 }


 @media (max-width: 425px) {
.sidebar{
width: 200px;
left: -200px;

}
.header{
padding: 0px 0px 0px 0px;

}

.section{
padding: 10px 10px 10px 10px;

}
.slidesidebar{
margin-left: 200px;
  }
.slidesection,.slideheader{
margin-left: 200px;

}

Yang terpenting jangan lupa untuk memasukan jquery ke dalam folder projek anda.
Sekian artikel singkat ini, semoga bermanfaat

Nanti kita akan praktekkan yang  kayag video di bawah ini,tunggu ya...


Lihat demonya disini http://www.demoredsscript.co.nf/sidebarresponsive/

Saya lahir di Lamongan,besar d Lamongan. Sempat mengenyam pendidikan S1 Sistem informasi di perguruan tinggi swasta d Surabaya.Alhamdulillah lulus. Ketertarikanku di dunia teknologi informasi khususnya di website di mulai dari tahun 2010,hingga sekarang masih berkutat di bidang Teknologi Informasi

Share this

Related Posts

Previous
Next Post »

Informasi Yang Harus Kamu Ketahui

loading...