i have a div container that is <div class= "mcontainer is-active" id="mcontainer"></div>
and for some reason the gasp to function works if written outside any function but when i add it to a function it logs "gasp target not found", i tried everything even passing a variable assigned with the queryselector function and it still didn't work
code:
open = true;
const tl = gsap.timeline({duration: 1});
const dropicon = document.getElementById("dropicon")
dropicon.addEventListener('click',dropDownMenu);
const mcontainer = document.getElementById("mcontainer");
//works here//
tl.to(mcontainer,{height:"100%"}, 0);
function dropDownMenu(){
if(open === true){
mcontainer.classList.toggle("is-active");
open = false;
//doesn't work here//
tl.to(mcontainer,{height:"100%"}, 0);
}
if(open === false){
tl.to(mcontainer,{height:"0"}, "<");
open = true;
}
}