0
I’m studying jQuery and I’m using the slideToggle
and as the documentation says, it should slide to its current opposite position.
I don’t quite understand it but it just slides down.
$(document).ready(function(){
$('li')
.hide();
});
$('#btn-menu').click(function(){
$('li')
.toggle()
.slideToggle();
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<button id="btn-menu">MENU</button>
<ul id="menu">
<li>Menu1</li>
<li>Menu2</li>
<li>Menu3</li>
<li>Menu4</li>
</ul>
Why are you using
toggle()
before, just do$('li').slideToggle();
– NoobSaibot