Submenu Customization
yozo556
Registered Users Posts: 1 Beginner grinner
Hi,
I'm wondering how to change the look of the submenu on the navigation menu. I would like it so that when a primary menu link is clicked, the submenus appear below the primary link and indented (not on separate tag).
Site: oftedahlphoto.com
Thanks!
I'm wondering how to change the look of the submenu on the navigation menu. I would like it so that when a primary menu link is clicked, the submenus appear below the primary link and indented (not on separate tag).
Site: oftedahlphoto.com
Thanks!
0
Comments
You can change the menu layout via the site customizer. Go to to customize>customize site. Then hover over that menu content block and click the wrench icon. From there, go to the line that says 'layout style'. You should see several options there. In this case, the accordion style might be more of what you are looking for.
Josie
SmugMug Support Hero
You should be able to adapt these for doing what you want.
I also use this to move my sub-menu up a bit. You could use this code to move it down as well, I think:
Former SmugMug Product Team
aaron AT aaronmphotography DOT com
Website: http://www.aaronmphotography.com
My SmugMug CSS Customizations website: http://www.aaronmphotography.com/Customizations
I do have a related issue though. I am trying to use a submenu on my site, but when viewed on a mobile/smallscreen device this menu:
(a.) switches to an accordion style, no matter if I have set it as vertical with flyout
(b.) takes the entire width of the screen (the menu item at left and the '+' at right), again no matter what I do with margins/percentage
Both of which make it look terrible on said device. The menu in question is on the lefthand navbar, the menu item is "More".
Any ideas out there as to how I can make the menu follow consistency with how I have set it under my customisation?? Seems arbitrary that the smallscreen version just ignores everything and does it's own thing.
(Bonus subquestion - Assuming I can get the smallscreen version to display the flyout submenu, ideally I would also like to alter the background opacity/alpha for this also, but using a colour reference format of, eg: seems to adopt the chosen colour, but ignore the alpha setting. Any ideas out there of what I could do?)
Sam
Sam
______________________________
SmugMug site - samuelmcdowell.com
The following code gets added to move your menu to the top:
You can negate all this by writing the opposite code of that and sticking it in a CSS block, however, your page doesn't really fit anymore.
I think the best option would be to customize the look/feel of the mobile version so it looks better but still functions as a mobile site. I discuss how to do that here: http://www.aaronmphotography.com/Customizations/Sitewide/Screen-Width-Customizations. I'd also be more than glad to help teach you / assist with creating the CSS code to do this.
Lastly, you use 2 menu content blocks to create your menu, one that just has "Photography". You probably don't want to do this. Use 1 menu block and then we can throw together some CSS to space it out and put the separator (in this case it would be a bottom border) where you want them.
-Aaron
Former SmugMug Product Team
aaron AT aaronmphotography DOT com
Website: http://www.aaronmphotography.com
My SmugMug CSS Customizations website: http://www.aaronmphotography.com/Customizations
Last things first - the reason I used individual, single-item menu blocks was actually to get around another mobile limitation. On smaller screens any menu with more than 1 item gets lumped into a big, ugly black box with "Menu" as its title, and put in the middle of the screen. Multiple menus result in multiple big "Menu" blocks in the middle of the screen. The seperator was not the reason for my approach - I originally had 3 other menu blocks (each with one item) beneath that seperator. It may seem counter-intuitive, but it has served its purpose! The menus looked right, and behaved right(ish). But I am happy to learn a better way!
Those 3 menu items are what I am now trying to put into a submenu under a single item "More", in a nice way, to further minimalise the look of my site.
For the ideas you have suggested for this question - thank you so much. I am going to give them a go and see where I get to. I will advise if I get it right or not, back here in case others have this question.
I assumed there was probably a screen space issue that was driving forcing the menu to accordion on small screens regardless. But it then ignoring any attempts to alter margins, etc was messing things up. Some feedback for the team - if the sidebar cannot translate well to mobile screens, then it seems strange to offer SM themes with sidebars playing such a central role (I really haven't diverged from the basic theme much) or at least flag it on the site as being 'less mobile friendly' or something.
I'll let you know how my attempts work out! But thanks again.
Sam
Sam
______________________________
SmugMug site - samuelmcdowell.com
Gotcha on the other items! In response to the big "Menu" that gets displayed. If you have the option in your menu content block for "Collapse for mobile" set to ON, then the big "MENU" button gets displayed. If you set that to "OFF" then your menu is open and does not display "MENU" when the user comes to the site. So if you wanted:
"Photography
More +"
All you have to do is set it to OFF and you're set. You can see it on my site if you view www.aaronmphotography.com from a mobile screen:
mobile_version.jpg
That's just 1 menu content block for that entire thing.
Former SmugMug Product Team
aaron AT aaronmphotography DOT com
Website: http://www.aaronmphotography.com
My SmugMug CSS Customizations website: http://www.aaronmphotography.com/Customizations
I read through your thoughts, code, etc and have managed to get this far:
- Move to a single menu block, accordion style
- Align text center, and figure out how to change the colour/opacity of the bottom border lines: - Figured out I could show/hide the bottom borders by adding border-bottom-style: none; to the code above
- Figured out the centring didn't work on small screens, but this would fix that:
And that has just about got me to the finish line!
There are just a couple of things I haven't figured out that maybe you could point me in the right direction?
Ideally I would like a single line (like the Separator) between 'Photography' and 'Menu'. I don't want any other lines, including between submenu items. Just that one. And I would like to change how long this line is. I figured maybe this could be done by manipulating one of the border lines? As per above, I have figured out how to match colour/opacity of the theme's 'Separator' and how to turn all border lines off/on - but not at an individual item level. (This is my biggest failure with CSS - I understand the class/id theory, but actually targeting the element(s) I want I really struggle with. Seems to be a black magic I can't figure out!)
My questions:
Any thoughts?
EDIT: Quick update - I think I've sorted number 4. I've figured out how to change alignment/margins etc for the submenu.
Thanks for your help to date, and for your patience.
Sam
Sam
______________________________
SmugMug site - samuelmcdowell.com
Try:
Change the % to control how wide the border is. Make sure they're the same # so things are centered.
Former SmugMug Product Team
aaron AT aaronmphotography DOT com
Website: http://www.aaronmphotography.com
My SmugMug CSS Customizations website: http://www.aaronmphotography.com/Customizations
Is there anything else you'd like to do? We can certainly cook up some CSS!
Former SmugMug Product Team
aaron AT aaronmphotography DOT com
Website: http://www.aaronmphotography.com
My SmugMug CSS Customizations website: http://www.aaronmphotography.com/Customizations
Although I have since realised it is not quite the magic bullet for me - as this also affects the 1st element of the submenu. And the default, faint bottom borders of the other submenu items are also still there...
All that is to say that you (and some w3schools) have put me onto some good ideas here, which I haven't had a chance to investigate fully myself, but I intend to tomorrow. (Also suffice to say I may have more questions after said investigating...)
As for "cooking up some CSS" for other ideas - aren't you busy enough?!?!
Thank you Aaron.
Sam
______________________________
SmugMug site - samuelmcdowell.com
I've cooked up some new code that should fix this issue:
The slight variation was done by addeding a little identifier to the first menu item ... New part is in red.
This should get rid of those:
I'm here to help
Former SmugMug Product Team
aaron AT aaronmphotography DOT com
Website: http://www.aaronmphotography.com
My SmugMug CSS Customizations website: http://www.aaronmphotography.com/Customizations
That nailed it. Plus I was able to use what I have learnt from this little exchange to do a couple of other things - remove the "+" sign beside the top level accordion menu, and set a hover colour change on the links, to name two. Fantastic!
As for other things, I think I will give you a rest for a little while, let someone else get the benefit of your assistance! I prob want to tweak the mobile view some more at some stage - I am still not super happy with some of the spacing, but it is looking WAY better now than it ever has.
I would like to be become more self-sufficient in CSS, but I still struggle quite a bit in successfully 'targeting' the element I want to adjust. Your intro to "nth-of" etc led me onto the w3schools list of selectors, which is a huge step forward. However when inspecting elements and there is a big long trail of class names showing, I haven't figured out the logic behind honing down to what I am targeting. It may just be a matter of practice, but if there are any other tools/references that you think may be of use to someone like me, then by all means let me know!
Thanks for your invaluable assistance, Aaron. I really appreciate it.
Sam
Sam
______________________________
SmugMug site - samuelmcdowell.com
Sam
Sam
______________________________
SmugMug site - samuelmcdowell.com
That's how I do it now
In terms of figuring out which CSS identifier to use. Chrome does a nice job of highlighting which section is which when you put your mouse over the code. I then always look for the "class= ...". Often times there's multiple identifiers in there. You just need to pick one ... I tend to look for ones that are fairly unique and more specific to exactly what I'm trying to do. You can create a cascade of them by putting a space in between to help be more specific. For example:
If you only wanted to touch the first div2, you could use CSS code: so that it would only touch the div2b that's within div1
Hope that helps a bit!
Former SmugMug Product Team
aaron AT aaronmphotography DOT com
Website: http://www.aaronmphotography.com
My SmugMug CSS Customizations website: http://www.aaronmphotography.com/Customizations
1.) The difference between referencing elements with a space in between (so like your .div1 .div2b example above) and referencing elements with '>' in between as you did in a piece of your code you gave me above (.sm-accordion>.sm-accordion-item>.sm-accordion-item-label). I understand the latter is to refer to child elements? But not sure the difference that clearly.
2.) What to do when an attribute you try and change gets overwritten by another setting. Example: I tried to reduce spacing on some widgets at the bottom of my screen for smallscreen devices, I figured out a command that would work by entering it in the console, then put this into my CSS as follows: Then I publish that, but it doesn't work and when I go to the console I can see it there but it is crossed out as something has precedence over my setting. But is there a way to identify what, and maybe overcome it?
I sometimes think I have it clear, then it goes awfully confused again!
Hmmm...didn't mean to turn this into CSS 101...
Sam
Sam
______________________________
SmugMug site - samuelmcdowell.com
happens. Once I find the tab with the CSS I delete about 50%, then the other 50%. After each hitting "undo". This
way I can march in to find the exact CSS causing the problem.
My Website index | My Blog
The way things work is that SmugMug always loads your CSS content blocks or Theme's CSS AFTER their own. So anything you enter with !important should get overwritten with your own CSS. The only thing that would overwrite your own is if you then add a second case somewhere else that overwrites it.
Former SmugMug Product Team
aaron AT aaronmphotography DOT com
Website: http://www.aaronmphotography.com
My SmugMug CSS Customizations website: http://www.aaronmphotography.com/Customizations
Cheers Allen! I haven't tried using FF for this. Good idea. Might have to install it and give it a go, see if it helps cover my inadequacies better....
Sam
Sam
______________________________
SmugMug site - samuelmcdowell.com
Hmmm. It seems that other commands I have used are working without the space before !important, and I just gave it a go with those problem ones with the space - still no luck.
So if the only other option is that I am overwriting it myself somewhere else, I will investigate that possibility tomorrow. I don't think that is it, as I keep all the CSS under the main area under the Theme customisation (rather than by page, etc). But still, perhaps I put something in the wrong place a loooong time back.
Good idea, as always, Aaron. Ta.
Sam
Sam
______________________________
SmugMug site - samuelmcdowell.com
Let me know how it goes. If you are still stumped I'll pop on over and see if I can find the culprit.
Former SmugMug Product Team
aaron AT aaronmphotography DOT com
Website: http://www.aaronmphotography.com
My SmugMug CSS Customizations website: http://www.aaronmphotography.com/Customizations
Seeing as you asked for it!
I had a look through and the conflicting code isn't coming from me. I tried a few things, but my attempts to set margins/padding always get overwritten. I did some digging and you can see from the photo where things are going wrong:
Screen Shotx.jpg
The red arrow is pointing to the style overwriting mine (which has the green arrow). Other commands work here to affect the widget, but not margin/padding. I had a look at the code providing this styling (by clicking on it to the left) and it seems to be some fairly generic stuff given the comments in there. Certainly not my code. Must be coming from SM somewhere?
So it is not a big issue for me anymore as I have figured out a workaround. It is not my 'ideal' solution - the repositioning approach of elements doesn't let me add a background (with alpha) to these elements as I start to get gaps or overlaps with the background. Hence my preference to control it with padding/margins. But I am happy with the way it works.
There you are - in case you were interested/had any thoughts!
Sam
Sam
______________________________
SmugMug site - samuelmcdowell.com
Have you tried placing a CSS block at the bottom of your page and seeing if it will overwrite the code? If there's multiple !important's, CSS will take whatever the last code is.
Former SmugMug Product Team
aaron AT aaronmphotography DOT com
Website: http://www.aaronmphotography.com
My SmugMug CSS Customizations website: http://www.aaronmphotography.com/Customizations
I tried your suggestion of adding CSS blocks to Entire Site and also to the Homepage, but neither seemed to work. (In fact, couldn't even see them being 'overwritten' as per the earlier examples above). Not sure what is happening, but think I will put this one to bed now as it is taking up more time (both mine AND yours!) than it is worth. Thanks for your help.
Sam
Sam
______________________________
SmugMug site - samuelmcdowell.com
To emphasize the parent link in the navbar, you can use CSS code similar to this. You may read more here: http://www.aaronmphotography.com/Customizations/Navbar/Emphasize-Active-Page
Former SmugMug Product Team
aaron AT aaronmphotography DOT com
Website: http://www.aaronmphotography.com
My SmugMug CSS Customizations website: http://www.aaronmphotography.com/Customizations
Sam
______________________________
SmugMug site - samuelmcdowell.com