i'm looking for solution for that: I want add class (.hide) to div (#menu) to hide them, then when body got class (.pp-viewing-page2) a want to remove class (.hide)
I do this but doesn't work
($("#menu").addClass("menuscroll")) and
if ($("body").hasClass("pp-viewing-page2")) {
$("#menu").removeClass("hide");
}
Adding class for body works very well of course, body get class after scrolldown
Please help
I am not sure of what you mean or achieve excatly, but I created a little snippet for you.
Hope it helps.
https://jsfiddle.net/1L81r7v3/
Basically we first add the hide
class which "hides" the display (css display:none;)
, afterwards we check wether #body
has the class pp-viewing-page2
or not.
If #body
has that class we just remove the class.
For now you have to manually add the class in the fiddle so you can understand, I added a few comments into the fiddle.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.