I'm trying to change the background in Slicknav for when the Slicknav menu is opened and closed.
i use this code, but it doesnt work to me.
$(function(){
var $bg;
$('#menu-home').slicknav({
duplicate: false,
label: '',
init: function(){
$bg = $(".slicknav_menu");
},
open: function(){
$bg.css({'background': '#222 !important'});
},
close: function(){
$bg.css({'background': 'rgba(0, 0, 0, 0)'});
}
});
});
I've tried using basic if this then that and I feel like I'm just messing up this very simple piece of javascript.
Any help would be greatly appreciated!