I am trying to get my submenu drop down span the FULL width of the screen. I am not sure how to break it out of the Bootstrap 3 structure in order to achieve what I am after.
Well the dropdown menu will base its coordinates and width off of the nearest stacking context. So we just need to unset them. Here are all the potential stacking contexts (i.e. parents that have position:relative)
.menu li (the LIs)
.menu (the parent <ul>)
col-md-10 col-sm-10 columns (the <div> parent right above .menu)
So on .menu{} and .menu li{} you can simply remove the position:relative set. However, on the bootstrap classes element…I’d simply add a class. For example, add in the class “position-none” and then in your custom CSS file, add in the below
.position-none
{
position:static!important;
}
This will undo the position:relative on the bootstrap and make the dropdown look to the next stacking context, and now it will be <body> which spans the full page.
Thanks for the response, but I am sorry I do not full understand I have updated the link, I removed position:relative and added the class position-none, but I must be doing something very wrong!
Please revert it back to the original and I can walk you through.
You were ONLY supposed to remove position:relative on those classes. Not ALL the CSS for the menu.
Also, you did apply the class of position-none but I don’t see it in your CSS file? Did you not follow my instructions and add the CSS I posted to your CSS file…?
Whatever you did caused all the CSS in your theme.css not apply to the menu. The menu was unstyled when you did the original changes I requested so something got screwed up somewhere.
CTRL+F (search) and find .menu {}. You will see position:relative on there. ONLY remove position:relative. Nothing else.
CTRL+F (search) and find .menu li {}. You will see position:relative on there. ONLY remove position:relative. Nothing else. .menu li{} is RIGHT below .menu so you don’t need to search if you don’t want to
Go to the end of your CSS file. Add in this code
.position-none {
position:static!important;
}
Now in your HTML file for that page, find the <ul class="menu"> element. Look directly above and you will see a div that has class=“col-md-10 col-sm-10 columns”. On that element, ADD in the class “position-none”. Your new class string will look like this “col-md-10 col-sm-10 columns position-none”
Now go to your dropdown in the HTML…class=“.subnav-fullwidth”. That element has an inline style of width:1170px. Remove that.
Go back to your theme.css file and on “.subnav-fullwidth” please add in “width:100%;” to that CSS class.
Ok, well I’m not exactly sure what you are using Javascript for in the dropdown. Is your Javascript doing anything special for the dropdown menu besides showing it? Because that can be done in CSS and Javascript is not needed. You can remove the dropdown JS if that’s the cas.e
You have to be careful with those bootstrap menus as they are coded for the whole range and you will need to take care of the smaller screen version when the hamburger kicks in.
Yes Javascript is being used for that. However CSS can make the menu sticky. The Javascript is also having it fade in, which CSS can basically replicate. Remove the Javascript for the menu and we will go from there as to recreating it in CSS. A more stable approach, for sure.
Yes Pauls would definitely work but it would be best to get this done and get a good structure.
Also I see that there is still Javascript at play with the menu, and it doesn’t seem to have lost any functionality. Did you comment out the right script?
I just looked at the live site and I don’t see any scripts commented out.