iamx
iamx

Reputation: 63

Hide a div or class element on specific pages and show on other

I would like to hide the following div/class only on few pages of my website:

    <div class="topNav">
    <nav id="display_menu_5" class="menu">
    ......

I have tried using jQuery but it didn't help, and using php I have managed to hide it on all pages, I am really hitting a brick wall here with this, how this can be done?

If it can be of any help I am doing this in a template on a ecommerce platform - Volusion, so I might be hindered by that in some way.

Upvotes: 0

Views: 1123

Answers (2)

iamx
iamx

Reputation: 63

Answering my own question because I found a solution using css only. I was able to access the desired pages through Volusion description fields and I added an inline style to each page like this:

    <style>
    .topNav{display:none !important;}
    </style>            

Upvotes: 0

Rebirth
Rebirth

Reputation: 1011

I'm assuming you are using different files, which you include in each other.

which gives the possibility to set a variable in the php file called by the url/page like:

$nav_visible = true;

and in your nav.php file:

if (isset($nav_visible)) {
    echo '<div class="topNav">';
}

alternatively you can check if the variable is true or false instead of checking for it's existence.

Upvotes: 2

Related Questions