I am trying to hide a <p> element when a link is hovered. The site is running on drupal and I am using a superfish module for the nav bar. When I hover over the navigational links the secondary nav bar drops down.
What I would like to happen is when the secondary nav bar drops down for the slogan of the website to disappear. In other words I would like the secondary nav bar to cover up or take the place of the slogan. Any ideas on how to get this to work?
You could use JavaScript, something like this:
The script above sets the element (in this case, the
p) to make apply the CSS codedisplay:noneto the div with the iddisappear. You could set JavaScript to apply any CSS property to wanted, virtually. Like you could use JavaScript to make the div reappear. This could also be accomplished with jQuery, like this:or to remove from the DOM:
or to make it reappear:
This is shorthand. You could also set jQuery to do something like this:
And with the code above, like the pure JavaScript solution, could be edited to apply any CSS property.
You can edit this script to suit your needs. Tell me if this works, or if you need further help.
If this helps you, remember to click the check near this answer. It would really help. Thanks. 🙂