javascript - Add and remove div class -
i'm looking solution that: want add class (.hide) div (#menu) hide them, when body got class (.pp-viewing-page2) want remove class (.hide)
i doesn't work
($("#menu").addclass("menuscroll")) , if ($("body").hasclass("pp-viewing-page2")) { $("#menu").removeclass("hide"); }
adding class body works of course, body class after scrolldown
please help
i not sure of mean or achieve excatly, created little snippet you.
hope helps.
https://jsfiddle.net/1l81r7v3/
basically first add hide
class "hides" display (css display:none;)
, afterwards check wether #body
has class pp-viewing-page2
or not.
if #body
has class remove class.
for have manually add class in fiddle can understand, added few comments fiddle.
Comments
Post a Comment