Changeset 43892 for branches/5.0/src/wp-content/themes/twentynineteen/sass/navigation/_menu-main-navigation.scss
- Timestamp:
- 11/12/2018 11:19:13 PM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/5.0/src/wp-content/themes/twentynineteen/sass/navigation/_menu-main-navigation.scss
r43860 r43892 16 16 .main-menu { 17 17 18 display: inline ;18 display: inline-block; 19 19 margin: 0; 20 20 padding: 0; … … 24 24 color: $color__link; 25 25 display: inline; 26 27 @include media(tablet) { 28 position: relative; 29 } 26 position: relative; 30 27 31 28 > a { … … 48 45 49 46 display: inline-block; 47 position: inherit; 48 49 @include media(tablet) { 50 position: relative; 51 } 50 52 51 53 > a { … … 62 64 } 63 65 64 .mobile-submenu-expand svg, 65 .desktop-submenu-expand svg { 66 position: relative; 67 top: 0.2rem; 68 } 69 70 .mobile-submenu-expand, 71 .desktop-submenu-expand { 66 .submenu-expand { 67 display: inline-block; 72 68 margin-right: #{0.5 * $size__spacing-unit}; 73 } 74 } 75 76 &:last-child > a { 69 70 /* Priority+ Menu */ 71 &.main-menu-more-toggle { 72 73 position: relative; 74 height: 24px; 75 line-height: $font__line-height-heading; 76 width: 24px; 77 padding: 0; 78 margin-left: #{0.5 * $size__spacing-unit}; 79 80 svg { 81 height: 24px; 82 width: 24px; 83 top: #{-0.125 * $size__spacing-unit}; 84 vertical-align: text-bottom; 85 } 86 } 87 88 svg { 89 position: relative; 90 top: 0.2rem; 91 } 92 } 93 } 94 95 &:last-child > a, 96 &:last-child.menu-item-has-children .submenu-expand { 77 97 margin-right: 0; 78 98 } 79 99 } 100 101 .is-hidden { 102 display: none; 103 } 80 104 } 81 105 82 106 .sub-menu { 83 107 84 background : $color__link;108 background-color: $color__link; 85 109 color: $color__background-body; 86 110 list-style: none; … … 88 112 89 113 display: none; 90 float: left;91 114 position: absolute; 92 115 opacity: 0; … … 95 118 96 119 @include media(tablet) { 97 width: max-content; 98 max-width: calc(3 * (100vw / 12)); 120 width: auto; 121 min-width: -moz-max-content; 122 min-width: -webkit-max-content; 123 min-width: max-content; 99 124 } 100 125 101 126 > li { 102 127 103 clear: both;104 128 display: block; 105 129 float: none; 106 130 position: relative; 107 word-break: break-word;108 131 109 132 &.menu-item-has-children { 110 133 111 . mobile-submenu-expand,112 .desktop-submenu-expand {134 .submenu-expand { 135 display: inline-block; 113 136 position: absolute; 114 137 width: calc( 24px + #{$size__spacing-unit} ); … … 125 148 } 126 149 127 .mobile-submenu-expand, 128 .desktop-submenu-expand { 150 .submenu-expand { 129 151 margin-right: 0; 130 152 } 131 153 132 154 @include media(tablet) { 155 133 156 .menu-item-has-children > a { 134 157 … … 140 163 } 141 164 142 > a:not(.mobile-submenu-expand) { 165 > a, 166 > .menu-item-link-return { 167 143 168 color: $color__background-body; 144 169 display: block; 145 170 line-height: $font__line-height-heading; 146 171 padding: calc( .5 * #{$size__spacing-unit} ) calc( 24px + #{$size__spacing-unit} ) calc( .5 * #{$size__spacing-unit} ) $size__spacing-unit; 172 white-space: nowrap; 147 173 148 174 &:hover, … … 157 183 158 184 &.mobile-parent-nav-menu-item { 185 159 186 display: none; 160 187 font-size: $font__size-sm; … … 171 198 172 199 /* 200 * Sub-menu styles 201 * 173 202 * :focus-within needs its own selector so other similar 174 203 * selectors don’t get ignored if a browser doesn’t recognize it 175 204 */ 176 .main-menu .menu-item-has-children:focus-within > .sub-menu { 205 .main-menu .menu-item-has-children:not(.off-canvas):focus-within > .sub-menu { 206 177 207 display: block; 178 208 left: 0; 179 209 margin-top: 0; 180 210 opacity: 1; 181 width: calc( 100vw - #{$size__spacing-unit * 2}); 182 183 .sub-menu { 184 185 margin-top: inherit; 186 position: relative; 187 padding-left: $size__spacing-unit; 188 189 @include media(tablet) { 190 padding-left: 0; 191 position: absolute; 192 left: 100%; 193 width: max-content; 194 top: 0; 195 } 196 } 197 } 198 199 .main-menu .menu-item-has-children:hover > .sub-menu, 200 .main-menu .menu-item-has-children:focus > .sub-menu, 201 .main-menu .menu-item-has-children .sub-menu:hover, 202 .main-menu .menu-item-has-children .sub-menu:focus { 211 width: auto; 212 min-width: 100%; 213 214 203 215 /* Non-mobile position */ 204 216 @include media(tablet) { 205 display: table;217 display: block; 206 218 margin-top: 0; 207 219 opacity: 1; … … 212 224 bottom: auto; 213 225 height: auto; 214 width: max-content; 226 min-width: -moz-max-content; 227 min-width: -webkit-max-content; 228 min-width: max-content; 215 229 transform: none; 216 animation: fade_in 0.1s forwards; 230 } 231 232 &.hidden-links { 233 left: 0; 234 width: 100%; 235 display: table; 236 position: absolute; 237 238 @include media(tablet) { 239 right: 0; 240 left: auto; 241 display: block; 242 width: max-content; 243 } 244 } 245 246 .submenu-expand { 247 display: none; 217 248 } 218 249 219 250 .sub-menu { 220 251 display: block; 252 margin-top: inherit; 253 position: relative; 254 width: 100%; 255 left: 0; 256 opacity: 1; 257 258 /* Non-mobile position */ 221 259 @include media(tablet) { 222 margin-top: inherit; 223 padding-left: 0; 224 position: absolute; 225 left: 100%; 226 top: 0; 227 } 228 } 229 } 230 231 .main-menu .menu-item-has-children.focus .sub-menu.expanded-true { 232 233 display: table; 260 float: none; 261 max-width: 100%; 262 } 263 } 264 265 /* Nested sub-menu padding: 10 levels deep */ 266 .sub-menu li > a:before { 267 font-family: $font__body; 268 font-weight: normal; 269 } 270 .sub-menu > li > a:before { 271 content: "\2013\00a0"; 272 } 273 .sub-menu .sub-menu li > a:before { 274 content: "\2013\00a0\2013\00a0"; 275 } 276 .sub-menu .sub-menu .sub-menu li > a:before { 277 content: "\2013\00a0\2013\00a0\2013\00a0"; 278 } 279 .sub-menu .sub-menu .sub-menu .sub-menu li > a:before { 280 content: "\2013\00a0\2013\00a0\2013\00a0\2013\00a0"; 281 } 282 .sub-menu .sub-menu .sub-menu .sub-menu .sub-menu li > a:before { 283 content: "\2013\00a0\2013\00a0\2013\00a0\2013\00a0"; 284 } 285 .sub-menu .sub-menu .sub-menu .sub-menu .sub-menu .sub-menu li > a:before { 286 content: "\2013\00a0\2013\00a0\2013\00a0\2013\00a0\2013\00a0"; 287 } 288 .sub-menu .sub-menu .sub-menu .sub-menu .sub-menu .sub-menu .sub-menu li > a:before { 289 content: "\2013\00a0\2013\00a0\2013\00a0\2013\00a0\2013\00a0\2013\00a0"; 290 } 291 .sub-menu .sub-menu .sub-menu .sub-menu .sub-menu .sub-menu .sub-menu .sub-menu li > a:before { 292 content: "\2013\00a0\2013\00a0\2013\00a0\2013\00a0\2013\00a0\2013\00a0\2013\00a0"; 293 } 294 .sub-menu .sub-menu .sub-menu .sub-menu .sub-menu .sub-menu .sub-menu .sub-menu .sub-menu li > a:before { 295 content: "\2013\00a0\2013\00a0\2013\00a0\2013\00a0\2013\00a0\2013\00a0\2013\00a0\2013\00a0"; 296 } 297 } 298 299 .main-menu .menu-item-has-children:not(.off-canvas):hover > .sub-menu, 300 .main-menu .menu-item-has-children:not(.off-canvas):focus > .sub-menu, 301 .main-menu .menu-item-has-children.is-focused:not(.off-canvas) > .sub-menu { 302 303 display: block; 304 left: 0; 234 305 margin-top: 0; 235 306 opacity: 1; 236 padding-left: 0; 237 238 /* Mobile position */ 239 left: 0; 240 top: 0; 241 right: 0; 242 bottom: 0; 243 position: fixed; 244 z-index: 100000; /* Make sure appears above mobile admin bar */ 245 width: 100%; 246 height: 100%; 247 transform: translateX(+100%); 248 animation: slide_in_right 0.3s forwards; 249 250 > .mobile-parent-nav-menu-item { 251 display: inline-block; 252 } 253 } 254 255 /* Only show one submenu expand button at a time (desktop vs mobile) */ 256 .desktop-submenu-expand { 257 display: none; 258 307 width: auto; 308 min-width: 100%; 309 310 311 /* Non-mobile position */ 259 312 @include media(tablet) { 260 display: inline-block; 261 } 262 } 263 264 .mobile-submenu-expand { 265 display: inline-block; 266 267 @include media(tablet) { 313 display: block; 314 float: none; 315 margin-top: 0; 316 opacity: 1; 317 position: absolute; 318 left: 0; 319 right: auto; 320 top: auto; 321 bottom: auto; 322 height: auto; 323 min-width: -moz-max-content; 324 min-width: -webkit-max-content; 325 min-width: max-content; 326 transform: none; 327 } 328 329 &.hidden-links { 330 left: 0; 331 width: 100%; 332 display: table; 333 position: absolute; 334 335 @include media(tablet) { 336 right: 0; 337 left: auto; 338 display: table; 339 width: max-content; 340 } 341 } 342 343 .submenu-expand { 268 344 display: none; 269 345 } 270 } 271 346 347 .sub-menu { 348 display: block; 349 margin-top: inherit; 350 position: relative; 351 width: 100%; 352 left: 0; 353 opacity: 1; 354 355 /* Non-mobile position */ 356 @include media(tablet) { 357 float: none; 358 max-width: 100%; 359 } 360 } 361 362 /* Nested sub-menu padding: 10 levels deep */ 363 .sub-menu li > a:before { 364 font-family: $font__body; 365 font-weight: normal; 366 } 367 .sub-menu > li > a:before { 368 content: "\2013\00a0"; 369 } 370 .sub-menu .sub-menu li > a:before { 371 content: "\2013\00a0\2013\00a0"; 372 } 373 .sub-menu .sub-menu .sub-menu li > a:before { 374 content: "\2013\00a0\2013\00a0\2013\00a0"; 375 } 376 .sub-menu .sub-menu .sub-menu .sub-menu li > a:before { 377 content: "\2013\00a0\2013\00a0\2013\00a0\2013\00a0"; 378 } 379 .sub-menu .sub-menu .sub-menu .sub-menu .sub-menu li > a:before { 380 content: "\2013\00a0\2013\00a0\2013\00a0\2013\00a0"; 381 } 382 .sub-menu .sub-menu .sub-menu .sub-menu .sub-menu .sub-menu li > a:before { 383 content: "\2013\00a0\2013\00a0\2013\00a0\2013\00a0\2013\00a0"; 384 } 385 .sub-menu .sub-menu .sub-menu .sub-menu .sub-menu .sub-menu .sub-menu li > a:before { 386 content: "\2013\00a0\2013\00a0\2013\00a0\2013\00a0\2013\00a0\2013\00a0"; 387 } 388 .sub-menu .sub-menu .sub-menu .sub-menu .sub-menu .sub-menu .sub-menu .sub-menu li > a:before { 389 content: "\2013\00a0\2013\00a0\2013\00a0\2013\00a0\2013\00a0\2013\00a0\2013\00a0"; 390 } 391 .sub-menu .sub-menu .sub-menu .sub-menu .sub-menu .sub-menu .sub-menu .sub-menu .sub-menu li > a:before { 392 content: "\2013\00a0\2013\00a0\2013\00a0\2013\00a0\2013\00a0\2013\00a0\2013\00a0\2013\00a0"; 393 } 394 } 395 396 /** 397 * Full-screen touch device styles 398 */ 399 .main-menu .menu-item-has-children.off-canvas .sub-menu { 400 401 animation: fade_in 0.1s forwards; 402 403 .submenu-expand .svg-icon { 404 transform: rotate(270deg); 405 } 406 407 .sub-menu { 408 opacity: 0; 409 position: absolute; 410 z-index: 0; 411 transform: translateX(-100%); 412 } 413 414 li:hover, 415 li:focus, 416 li > a:hover, 417 li > a:focus { 418 background-color: transparent; 419 } 420 421 &.expanded-true { 422 423 display: table; 424 margin-top: 0; 425 opacity: 1; 426 padding-left: 0; 427 428 /* Mobile position */ 429 left: 0; 430 top: 0; 431 right: 0; 432 bottom: 0; 433 position: fixed; 434 z-index: 100000; /* Make sure appears above mobile admin bar */ 435 width: 100vw; 436 height: 100vh; 437 max-width: 100vw; 438 transform: translateX(+100%); 439 animation: slide_in_right 0.3s forwards; 440 441 > .mobile-parent-nav-menu-item { 442 display: block; 443 } 444 445 /* Prevent menu from being blocked by admin bar */ 446 .admin-bar & { 447 top: 46px; 448 height: calc( 100vh - 46px ); 449 450 .sub-menu.expanded-true { 451 top: 0; 452 } 453 454 /* WP core breakpoint */ 455 @media only screen and ( min-width: 782px ) { 456 top: 32px; 457 height: calc( 100vh - 32px ); 458 459 .sub-menu.expanded-true { 460 top: 0; 461 } 462 } 463 } 464 } 465 } 272 466 } 273 467 274 /* Menu Animation */468 /* Menu animation */ 275 469 276 470 @keyframes slide_in_right {
Note: See TracChangeset
for help on using the changeset viewer.