Skip to content

Commit 97f1013

Browse files
authored
Merge pull request #306 from canjs/menu-fix
fix css issues with breadcrumb nav
2 parents 6357b97 + ba489cc commit 97f1013

File tree

4 files changed

+23
-7
lines changed

4 files changed

+23
-7
lines changed

static/breadcrumb.less

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212
color: lighten(@gray, 10%);
1313
a {
1414
cursor: pointer;
15+
}
16+
> a {
1517
color: white;
1618
font-weight: 700;
1719
}
@@ -62,13 +64,19 @@
6264
padding: @gutter/4 0;
6365
}
6466
}
67+
68+
.breadcrumb-dropdown-separator {
69+
display: none;
70+
}
71+
72+
&.dropdown-has-items .breadcrumb-dropdown-separator {
73+
display: inline-block;
74+
}
6575
}
6676
}
6777

6878
.on-this-page {
69-
width: 100%;
7079
font-size: 14px;
71-
margin-top:@gutter/2;
7280
margin-bottom: @gutter !important;
7381
background: #fff;
7482
list-style: none;
@@ -78,7 +86,6 @@
7886
}
7987
@media screen and (min-width: @breakpoint) {
8088
padding: @gutter;
81-
margin: 0;
8289
position: fixed;
8390
.box-shadow;
8491
z-index: 15;

static/canjs.js

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -282,9 +282,18 @@ function scrollToElement($element) {
282282
}
283283

284284
function setOnThisPageContent() {
285-
// don't bother with 1 header
285+
var $breadcrumb = $(".breadcrumb");
286286
var $h2 = $('h2');
287-
if ($h2.length < 2) {
287+
var showDropdown = $h2.length > 1;
288+
289+
if (showDropdown) {
290+
$breadcrumb.addClass('dropdown-has-items');
291+
} else {
292+
$breadcrumb.removeClass('dropdown-has-items');
293+
}
294+
295+
// don't bother with 1 header
296+
if (!showDropdown) {
288297
return;
289298
}
290299

static/mixins.less

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
-webkit-font-smoothing: antialiased;
2828
-moz-osx-font-smoothing: grayscale;
2929
}
30-
.box-shadow (@horizontal: 3px, @vertical: 3px, @blur: 10px, @color: rgba(0,0,0,.3)) {
30+
.box-shadow (@horizontal: 0px, @vertical: 7px, @blur: 10px, @color: rgba(0,0,0,.2)) {
3131
box-shadow: @horizontal @vertical @blur @color;
3232
}
3333
.code {

templates/breadcrumb.mustache

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
{{#with (getCurrent)}}
77
<li><a href="{{urlTo name}}">{{getShortTitle .}}</a></li>
88
{{/with}}
9+
<li class="breadcrumb-dropdown-separator"> / </li>
910
<li class="breadcrumb-dropdown">
10-
/
1111
<a> On this page</a>
1212
<ul class="on-this-page"></ul>
1313
</li>

0 commit comments

Comments
 (0)