-
-
Notifications
You must be signed in to change notification settings - Fork 970
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for properly functioning navbar submenus #1426
Conversation
For the
this change targets the second to last item (with text This uses a CSS path that targets any item with this type of relationship. This script generates files used to generate the site (and does the site render also): index <- '---
title: "My Website"
output: html_document
---
Hello, Website!'
about <- '---
title: "About This Website"
output: html_document
---
More about this website.'
sub_part_1 <- '---
title: "About This Website"
output: html_document
---
sub_1: This is right below the About page.'
sub_part_2 <- '---
title: "About This Website"
output: html_document
---
sub_2: This is 2 levels below the About page.'
write(index, file = "index.Rmd")
write(about, file = "about.Rmd")
write(sub_part_1, file = "sub1.Rmd")
write(sub_part_2, file = "sub2.Rmd")
rmarkdown::render("index.Rmd")
rmarkdown::render("about.Rmd")
rmarkdown::render("sub1.Rmd")
rmarkdown::render("sub2.Rmd")
render_site() |
The submenu now functions properly and jQuery was not used in this final solution. Here is a screenshot of the menu/submenu: Some CSS rules had to be added to 'restore' support for the The R code changes occurred entirely in the |
Forgot to mention it earlier... thanks @jcheng5 for the assistance on this! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me! Thanks!
inst/rmd/h/default.html
Outdated
margin-top:-6px; | ||
margin-left:-1px; | ||
-webkit-border-radius:0 6px 6px 6px; | ||
-moz-border-radius:0 6px 6px 6px; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We probably don't need the -webkit
and -moz
prefixes: https://caniuse.com/#feat=border-radius
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice, I'll take those lines out.
inst/rmd/h/default.html
Outdated
@@ -215,6 +215,49 @@ | |||
padding-top: $header_padding$px; | |||
margin-top: -$header_padding$px; | |||
} | |||
|
|||
.dropdown-submenu { | |||
position:relative; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you indent by 2 spaces and add spaces after colons (to be consistent with previous CSS code)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry for missing this. Will do!
We also need a NEWS entry for this feature (or perhaps bug fix). |
* Add JQuery function to modify class of submenu items Fixes rstudio#721 * Add CSS rules & refine JQuery function * Modify `navbar_links_tags()` to handle submenus * Remove previously added jQuery function * Remove CSS rules w.r.t. to WebKit/Mozilla * Reformat CSS rules for consistency
This fix is for replacing the class of a submenu item (3rd level down) such that it gets the
dropdown-submenu
class.Fixes #721