<html>
<head>
<title></title>
<link rel="stylesheet" type="text/css" href="style.css" />
</head>
<body>
I've been working on creating a sidebar for my website, but it's not functioning as expected. As a self-taught individual, I've made progress in various areas, but this particular sidebar seems to be giving me trouble. I've tried numerous approaches to fix it, but none have worked so far.
<div id="sidebar">
<ul>
<li><a href="#">Link 1</a></li>
<li><a href="#">Link 2</a></li>
<li><a href="#">Link 3</a></li>
<li><a href="#">Link 4</a></li>
<li><a href="#">Link 5</a></li>
</ul>
<div id="sidebar-btn">
<span></span>
<span></span>
<span></span>
</div>
</div>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3s/jquery.min.js"></script>
<script>
$(document).ready(function()
$('#sidebar-btn').click(function(){
$('#sidebar').addClass('visible');
});
</script>
</div>
</div>
</body>
</html>
<div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
<div class="snippet-code">
<pre class="snippet-code-js lang-js prettyprint-override"><code><script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3s/jquery.min.js"></script>
<script>
$(document).ready(function()
$('#sidebar-btn').click(function(){
$('#sidebar').addClass('visible');
});
</script>
body{
margin:0px
padding:0px;
font-family: "Helvetic Neue";
}
#sidebar{
background:#151718;
width:200px;
height:100%;
display:block;
position:absolute;
left:-200px;
top:0px;
transition:left 0.3s linear;
}
#sidebar.visible{
left:0px;
transition:left 0.3s linear;
}
ul{
margin:0px;
padding:0px;
}
ul li{
list-style:none;
}
ul li a{
background:#1C1E1F;
color:#ccc;
border-bottom: 1px solid #111;
display: block;
width:180px;
padding: 10px;
text-decoration: none;
}
#sidebar-btn{
display:inline-block;
vertical-align:middle;
width:20px;
height:15px;
cursor:pointer;
margin:20px;
position:absolute;
top:0px;
right:-60px;
}
#sidebar-btn span{
height:1px;
background:#111;
margin-bottom:5px;
display: block;
}
#sidebar-nth-child(2){
width: 75%
}
<html>
<head>
<title></title>
<link rel="stylesheet" type="text/css" href="style.css" />
</head>
<body>
<div id="sidebar">
<ul>
<li><a href="#">Link 1</a></li>
<li><a href="#">Link 2</a></li>
<li><a href="#">Link 3</a></li>
<li><a href="#">Link 4</a></li>
<li><a href="#">Link 5</a></li>
</ul>
<div id="sidebar-btn">
<span></span>
<span></span>
<span></span>
</div>
</div>
<script
src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3s/jquery.min.js"></script>
<script>
$(document).ready(function()
$('#sidebar-btn').click(function(){
$('#sidebar').addClass('visible');
});
</script>
</div>
</div>
</body>
</html>