0
When I’m on /start CSS header Nav ul li . submenu must be top:300px, on the other pages should be top:120px. I put inside the $(Document). ready(Function() { }); the following expression:
$("a[href='/inicio]").find("header nav ul li .submenu").css("top", "300px!important");
But it’s not working. The CSS is like this:
header nav ul li .submenu {
background: #f3f3f3;
border-top: 2px solid #ffae11;
border-radius: 3px;
box-shadow: 0 8px 12px rgba(0,0,0,0.2);
display: none;
font-size: 0;
padding: 15px 25px;
position: absolute;
top: 120px;
left: 0;
width: 100%;
margin-left: 0;
z-index: 2000;
}
You don’t need that Important, Important is only used when the DOM is being loaded. jquery will change anyway. That doesn’t solve the problem I know, but it’s already an initiative
– Bsalvo
Thanks, I’ll take it off.
– Felipe Viero Goulart
In fact you may even solve, given that the ! Mportant was misplaced and could be disturbing the instruction
– Bsalvo
I took the !Important but it’s not working yet.
– Felipe Viero Goulart
At a glance at my answer, you possess other style in the . submenu? within other elements or there is only one style for the
.submenu
?– Bsalvo
If you want to change the css on a single page it is much easier to put an id there and in the css change by id deichando id code after normal not to be about written
– Costamilam