I have a checkbox that should be being checked every time I click label. However, the js will only run the initial if statement. After that, when .menu-bar-checkbox.checked is false, the else statement won't run. And I am seeing the checkbox become checked.
So basically, after the label fades in, I can't also get it to animate on click afterwards. Thanks for the help!
My html:
<ul class="ul-links">
<li class="hide li-portfolio"><a href="index.html" class="selected">Portfolio</a></li>
<li class="hide"><a href="about.html">About</a></li>
<li class="hide li-contact"><a href="contact.html">Contact</a></li>
</ul>
<label class="no-pull menu-bar">
Menu
<input class="menu-bar-checkbox" type="checkbox">
</label>
My js:
$(function() {
var $hide = $('.hide');
$hide.hide();
$('label').on('click', function() {
if ($('.menu-bar-checkbox').checked = true) {
$hide.fadeIn(1000);
} else {
$('.ul-links').animate ({
height: 0,
}, 1000)
}
});
})
Aucun commentaire:
Enregistrer un commentaire