I’ve hidden my navbar using position. now I want navbar to appear when hamberger icon is clicked.
that’s how tried,
var menubtn = document.getElementById("menubtn")
var rspnsvnavlist = document.getElementById("rspnsvnavlist")
rspnsvnavlist.style.position = "left(-350px)";
menubtn.onclick = function (){
if(rspnsvnavlist.style.position = "left(350px)"){
rspnsvnavlist.style.position = "left(0)";
}
else{
rspnsvnavlist.style.position = "left(350px)";
}
}
3
Answers
Maybe this would help,
the position property is used for
static
relative
fixed
absolute
sticky
you should try :
rspnsvnavlist.style.left = "350px";
Question, there seems to be no animation to wanna move the element from a side to another, is there a reason not to just dissapear the element with the
display
property, and change it on click? example