_navigation.scss 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573
  1. /* ==========================================================================
  2. NAVIGATION
  3. ========================================================================== */
  4. /*
  5. Breadcrumb navigation links
  6. ========================================================================== */
  7. .breadcrumbs {
  8. @include clearfix;
  9. margin: 0 auto;
  10. max-width: 100%;
  11. padding-left: 1em;
  12. padding-right: 1em;
  13. font-family: $sans-serif;
  14. -webkit-animation: $intro-transition;
  15. animation: $intro-transition;
  16. -webkit-animation-delay: 0.3s;
  17. animation-delay: 0.3s;
  18. @include breakpoint($x-large) {
  19. max-width: $x-large;
  20. }
  21. ol {
  22. padding: 0;
  23. list-style: none;
  24. font-size: $type-size-6;
  25. @include breakpoint($large) {
  26. float: right;
  27. width: calc(100% - #{$right-sidebar-width-narrow});
  28. }
  29. @include breakpoint($x-large) {
  30. width: calc(100% - #{$right-sidebar-width});
  31. }
  32. }
  33. li {
  34. display: inline;
  35. }
  36. .current {
  37. font-weight: bold;
  38. }
  39. }
  40. /*
  41. Post pagination navigation links
  42. ========================================================================== */
  43. .pagination {
  44. @include clearfix();
  45. float: left;
  46. margin-top: 1em;
  47. padding-top: 1em;
  48. width: 100%;
  49. ul {
  50. margin: 0;
  51. padding: 0;
  52. list-style-type: none;
  53. font-family: $sans-serif;
  54. }
  55. li {
  56. display: block;
  57. float: left;
  58. margin-left: -1px;
  59. a {
  60. display: block;
  61. margin-bottom: 0.25em;
  62. padding: 0.5em 1em;
  63. font-family: $sans-serif;
  64. font-size: 14px;
  65. font-weight: bold;
  66. line-height: 1.5;
  67. text-align: center;
  68. text-decoration: none;
  69. color: $muted-text-color;
  70. border: 1px solid mix(#000, $border-color, 25%);
  71. border-radius: 0;
  72. &:hover {
  73. color: $link-color-hover;
  74. }
  75. &.current,
  76. &.current.disabled {
  77. color: #fff;
  78. background: $primary-color;
  79. }
  80. &.disabled {
  81. color: rgba($muted-text-color, 0.5);
  82. pointer-events: none;
  83. cursor: not-allowed;
  84. }
  85. }
  86. &:first-child {
  87. margin-left: 0;
  88. a {
  89. border-top-left-radius: $border-radius;
  90. border-bottom-left-radius: $border-radius;
  91. }
  92. }
  93. &:last-child {
  94. a {
  95. border-top-right-radius: $border-radius;
  96. border-bottom-right-radius: $border-radius;
  97. }
  98. }
  99. }
  100. /* next/previous buttons */
  101. &--pager {
  102. display: block;
  103. padding: 1em 2em;
  104. float: left;
  105. width: 50%;
  106. font-family: $sans-serif;
  107. font-size: $type-size-5;
  108. font-weight: bold;
  109. text-align: center;
  110. text-decoration: none;
  111. color: $muted-text-color;
  112. border: 1px solid mix(#000, $border-color, 25%);
  113. border-radius: $border-radius;
  114. &:hover {
  115. @include yiq-contrasted($muted-text-color);
  116. }
  117. &:first-child {
  118. border-top-right-radius: 0;
  119. border-bottom-right-radius: 0;
  120. }
  121. &:last-child {
  122. margin-left: -1px;
  123. border-top-left-radius: 0;
  124. border-bottom-left-radius: 0;
  125. }
  126. &.disabled {
  127. color: rgba($muted-text-color, 0.5);
  128. pointer-events: none;
  129. cursor: not-allowed;
  130. }
  131. }
  132. }
  133. .page__content + .pagination,
  134. .page__meta + .pagination,
  135. .page__share + .pagination,
  136. .page__comments + .pagination {
  137. margin-top: 2em;
  138. padding-top: 2em;
  139. border-top: 1px solid $border-color;
  140. }
  141. /*
  142. Priority plus navigation
  143. ========================================================================== */
  144. .greedy-nav {
  145. position: relative;
  146. display: -webkit-box;
  147. display: -ms-flexbox;
  148. display: flex;
  149. -webkit-box-align: center;
  150. -ms-flex-align: center;
  151. align-items: center;
  152. min-height: $nav-height;
  153. background: $background-color;
  154. a {
  155. display: block;
  156. margin: 0 1rem;
  157. color: $masthead-link-color;
  158. text-decoration: none;
  159. -webkit-transition: none;
  160. transition: none;
  161. &:hover {
  162. color: $masthead-link-color-hover;
  163. }
  164. &.site-logo {
  165. margin-left: 0;
  166. margin-right: 0.5rem;
  167. }
  168. &.site-title {
  169. margin-left: 0;
  170. }
  171. }
  172. img{
  173. -webkit-transition: none;
  174. transition: none;
  175. }
  176. &__toggle {
  177. -ms-flex-item-align: center;
  178. align-self: center;
  179. height: $nav-toggle-height;
  180. border: 0;
  181. outline: none;
  182. background-color: transparent;
  183. cursor: pointer;
  184. }
  185. .visible-links {
  186. display: -webkit-box;
  187. display: -ms-flexbox;
  188. display: flex;
  189. -webkit-box-pack: end;
  190. -ms-flex-pack: end;
  191. justify-content: flex-end;
  192. -webkit-box-flex: 1;
  193. -ms-flex: 1;
  194. flex: 1;
  195. overflow: hidden;
  196. li {
  197. -webkit-box-flex: 0;
  198. -ms-flex: none;
  199. flex: none;
  200. }
  201. a {
  202. position: relative;
  203. &:before {
  204. content: "";
  205. position: absolute;
  206. left: 0;
  207. bottom: 0;
  208. height: 4px;
  209. background: $primary-color;
  210. width: 100%;
  211. -webkit-transition: $global-transition;
  212. transition: $global-transition;
  213. -webkit-transform: scaleX(0) translate3d(0, 0, 0);
  214. transform: scaleX(0) translate3d(0, 0, 0); // hide
  215. }
  216. &:hover:before {
  217. -webkit-transform: scaleX(1);
  218. -ms-transform: scaleX(1);
  219. transform: scaleX(1); // reveal
  220. }
  221. }
  222. }
  223. .hidden-links {
  224. position: absolute;
  225. top: 100%;
  226. right: 0;
  227. margin-top: 15px;
  228. padding: 5px;
  229. border: 1px solid $border-color;
  230. border-radius: $border-radius;
  231. background: $background-color;
  232. -webkit-box-shadow: 0 2px 4px 0 rgba(#000, 0.16),
  233. 0 2px 10px 0 rgba(#000, 0.12);
  234. box-shadow: 0 2px 4px 0 rgba(#000, 0.16), 0 2px 10px 0 rgba(#000, 0.12);
  235. &.hidden {
  236. display: none;
  237. }
  238. a {
  239. margin: 0;
  240. padding: 10px 20px;
  241. font-size: $type-size-5;
  242. &:hover {
  243. color: $masthead-link-color-hover;
  244. background: $navicon-link-color-hover;
  245. }
  246. }
  247. &:before {
  248. content: "";
  249. position: absolute;
  250. top: -11px;
  251. right: 10px;
  252. width: 0;
  253. border-style: solid;
  254. border-width: 0 10px 10px;
  255. border-color: $border-color transparent;
  256. display: block;
  257. z-index: 0;
  258. }
  259. &:after {
  260. content: "";
  261. position: absolute;
  262. top: -10px;
  263. right: 10px;
  264. width: 0;
  265. border-style: solid;
  266. border-width: 0 10px 10px;
  267. border-color: $background-color transparent;
  268. display: block;
  269. z-index: 1;
  270. }
  271. li {
  272. display: block;
  273. border-bottom: 1px solid $border-color;
  274. &:last-child {
  275. border-bottom: none;
  276. }
  277. }
  278. }
  279. }
  280. .no-js {
  281. .greedy-nav {
  282. .visible-links {
  283. -ms-flex-wrap: wrap;
  284. flex-wrap: wrap;
  285. overflow: visible;
  286. }
  287. }
  288. }
  289. /*
  290. Navigation list
  291. ========================================================================== */
  292. .nav__list {
  293. margin-bottom: 1.5em;
  294. input[type="checkbox"],
  295. label {
  296. display: none;
  297. }
  298. @include breakpoint(max-width $large - 1px) {
  299. label {
  300. position: relative;
  301. display: inline-block;
  302. padding: 0.5em 2.5em 0.5em 1em;
  303. color: $gray;
  304. font-size: $type-size-6;
  305. font-weight: bold;
  306. border: 1px solid $light-gray;
  307. border-radius: $border-radius;
  308. z-index: 20;
  309. -webkit-transition: 0.2s ease-out;
  310. transition: 0.2s ease-out;
  311. cursor: pointer;
  312. &:before,
  313. &:after {
  314. content: "";
  315. position: absolute;
  316. right: 1em;
  317. top: 1.25em;
  318. width: 0.75em;
  319. height: 0.125em;
  320. line-height: 1;
  321. background-color: $gray;
  322. -webkit-transition: 0.2s ease-out;
  323. transition: 0.2s ease-out;
  324. }
  325. &:after {
  326. -webkit-transform: rotate(90deg);
  327. -ms-transform: rotate(90deg);
  328. transform: rotate(90deg);
  329. }
  330. &:hover {
  331. color: #fff;
  332. border-color: $gray;
  333. background-color: mix(white, #000, 20%);
  334. &:before,
  335. &:after {
  336. background-color: #fff;
  337. }
  338. }
  339. }
  340. /* selected*/
  341. input:checked + label {
  342. color: white;
  343. background-color: mix(white, #000, 20%);
  344. &:before,
  345. &:after {
  346. background-color: #fff;
  347. }
  348. }
  349. /* on hover show expand*/
  350. label:hover:after {
  351. -webkit-transform: rotate(90deg);
  352. -ms-transform: rotate(90deg);
  353. transform: rotate(90deg);
  354. }
  355. input:checked + label:hover:after {
  356. -webkit-transform: rotate(0);
  357. -ms-transform: rotate(0);
  358. transform: rotate(0);
  359. }
  360. ul {
  361. margin-bottom: 1em;
  362. }
  363. a {
  364. display: block;
  365. padding: 0.25em 0;
  366. @include breakpoint($large) {
  367. padding-top: 0.125em;
  368. padding-bottom: 0.125em;
  369. }
  370. &:hover {
  371. text-decoration: underline;
  372. }
  373. }
  374. }
  375. }
  376. .nav__list .nav__items {
  377. margin: 0;
  378. font-size: 1.25rem;
  379. a {
  380. color: inherit;
  381. }
  382. .active {
  383. margin-left: -0.5em;
  384. padding-left: 0.5em;
  385. padding-right: 0.5em;
  386. font-weight: bold;
  387. }
  388. @include breakpoint(max-width $large - 1px) {
  389. position: relative;
  390. max-height: 0;
  391. opacity: 0%;
  392. overflow: hidden;
  393. z-index: 10;
  394. -webkit-transition: 0.3s ease-in-out;
  395. transition: 0.3s ease-in-out;
  396. -webkit-transform: translate(0, 10%);
  397. -ms-transform: translate(0, 10%);
  398. transform: translate(0, 10%);
  399. }
  400. }
  401. @include breakpoint(max-width $large - 1px) {
  402. .nav__list input:checked ~ .nav__items {
  403. -webkit-transition: 0.5s ease-in-out;
  404. transition: 0.5s ease-in-out;
  405. max-height: 9999px; /* exaggerate max-height to accommodate tall lists*/
  406. overflow: visible;
  407. opacity: 1;
  408. margin-top: 1em;
  409. -webkit-transform: translate(0, 0);
  410. -ms-transform: translate(0, 0);
  411. transform: translate(0, 0);
  412. }
  413. }
  414. .nav__title {
  415. margin: 0;
  416. padding: 0.5rem 0.75rem;
  417. font-family: $sans-serif-narrow;
  418. font-size: $type-size-5;
  419. font-weight: bold;
  420. }
  421. .nav__sub-title {
  422. display: block;
  423. margin: 0.5rem 0;
  424. padding: 0.25rem 0;
  425. font-family: $sans-serif-narrow;
  426. font-size: $type-size-6;
  427. font-weight: bold;
  428. text-transform: uppercase;
  429. border-bottom: 1px solid $border-color;
  430. }
  431. /*
  432. Table of contents navigation
  433. ========================================================================== */
  434. .toc {
  435. font-family: $sans-serif-narrow;
  436. color: $gray;
  437. background-color: $background-color;
  438. border: 1px solid $border-color;
  439. border-radius: $border-radius;
  440. -webkit-box-shadow: $box-shadow;
  441. box-shadow: $box-shadow;
  442. .nav__title {
  443. color: #fff;
  444. font-size: $type-size-6;
  445. background: $primary-color;
  446. border-top-left-radius: $border-radius;
  447. border-top-right-radius: $border-radius;
  448. }
  449. // Scrollspy marks toc items as .active when they are in focus
  450. .active a {
  451. @include yiq-contrasted($active-color);
  452. }
  453. }
  454. .toc__menu {
  455. margin: 0;
  456. padding: 0;
  457. width: 100%;
  458. list-style: none;
  459. font-size: $type-size-6;
  460. @include breakpoint($large) {
  461. font-size: $type-size-7;
  462. }
  463. a {
  464. display: block;
  465. padding: 0.25rem 0.75rem;
  466. color: $muted-text-color;
  467. font-weight: bold;
  468. line-height: 1.5;
  469. border-bottom: 1px solid $border-color;
  470. &:hover {
  471. color: $text-color;
  472. }
  473. }
  474. li ul > li a {
  475. padding-left: 1.25rem;
  476. font-weight: normal;
  477. }
  478. li ul li ul > li a {
  479. padding-left: 1.75rem;
  480. }
  481. li ul li ul li ul > li a {
  482. padding-left: 2.25rem;
  483. }
  484. li ul li ul li ul li ul > li a {
  485. padding-left: 2.75rem;
  486. }
  487. li ul li ul li ul li ul li ul > li a {
  488. padding-left: 3.25rem
  489. }
  490. }