I am working in Wordpress and I was able to target an element to change some of the CSS with this exact code:
body.admin-bar .mobmenu{
top:140px;
}
I need to also target this exact element with Javascript to change it's CSS properties after the user has scrolled down the page to reset it back to: top:0px
How would I target this using Javascript since it's multiple class names? I can't assign it an ID
Assuming this is the only element with this classname.
You can use the document query selector
const myElement = document.querySelector("body.admin-bar.mobmenu")
Should do the trick