Changing a div style in wordpress when it change to another page?

Hi this is my first question here. So I am new here.
I am trying to change the margin-top of a div in a wordpress when it goes to another page.
Here is my code I put them in header:

<script type="text/javascript">
 $("#mycontentdiv").each(function() { 
        if (this.href == window.location.href) {
            $(this).addClass("classmargintop");
        }<br>
    });
</script>

<?php
   if ( is_front_page() != is_page('contact-us')){
   echo '<script type="text/javascript">'
   , 'thisfunctionofme();'
   , '</script>';
}
?>

is my conditional correct? I just based it in some codes in wordpress, and the javascript code I just see it here. I hope someone can help me thanks.

Related posts

Leave a Reply