0
CSS:
.nav {
width: 15%;
height: 800px;
background-color: #421;
margin-top: 55px;
float: left;
}
.nav-min {
width: 5% !important;
background-color: #ccc !important;
}
JS:
<script src="http://code.jquery.com/jquery-2.2.3.min.js"></script>
<script type="text/javascript">
$('#btn').click(function() {
$('.nav').toggleClass('nav-min');
});
</script>
HTML:
<nav class="nav">
<button class="btn btn-menu" id="btn">Menu</button>
</nav>
Here are tests I did and they worked http://jsfiddle.net/ukpm1uey/3/
but it didn’t run on the localhost, does anyone know what it might be? , I’ve checked if it’s saving, but it still doesn’t work at all
In jsFiddle it is working! What is your goal or what you are trying to do to say it is not working?
– Chun
Matheus, still very difficult to understand what your problem is, could you edit your question by adding more information? When you have a read time here -> http://answall.com/help/mcve
– Gabriel Rodrigues
So, I wanted to make a menu that decreases when I click on the button, but my code is not working :/, I built the jsFiddle code but it does not work in my code and it is practically clean
– Matheus Palma
are you sure you put a link tag with the initial css there ? in jsfiddle, just put it in the window, but in localhost you need a tag including css
– Nelson Teixeira