DOM manipulation - to hide element when particular class exist

0 votes
166 views
added Mar 26, 2018 in PHP by LC Marshal Captain (25,790 points)
edited May 4, 2018 by LC Marshal

To flag

<?php 
if ($node->uid == "65632") { 
  $newlaunches = "newlaunchpage"; 
}
?>

 

To add class on DOM

<div class="sticky-prop-header detail-header hidden-m <?php echo $newlaunches; ?>">

 

To addClass & hide

if ($(".sticky-prop-header").hasClass('newlaunchpage')) {
  $('body').addClass('newlaunches'); 
}

if($('body').hasClass('newlaunches')) {
  $('.float-agent-contact').hide();
} 
lazacode.org - Malaysia's programming knowledge sharing platform, where everyone can share their finding as reference to others.
...