Skip to content

Commit e9f9d31

Browse files
authored
Merge pull request #356 from canjs/354-fix-search-results-pushed-up
Fix #354 Search results on certain pages are getting pushed up
2 parents 77887a5 + 254edbd commit e9f9d31

File tree

4 files changed

+51
-42
lines changed

4 files changed

+51
-42
lines changed

static/canjs.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ function init() {
121121
function scrollToCurrentMenuItem(){
122122
var currentPageLi = $('li.current');
123123
if(currentPageLi.length){
124-
$('.bottom-left').scrollTop(currentPageLi.offset().top - $('.bottom-left').offset().top);
124+
$('.nav-menu').scrollTop(currentPageLi.offset().top - $('.nav-menu').offset().top);
125125
}
126126
}
127127

@@ -227,11 +227,11 @@ function navigate(href) {
227227
if (!$content.length) {
228228
window.location.reload();
229229
}
230-
var $nav = $content.find(".bottom-left > ul"),
230+
var $nav = $content.find(".bottom-left .scrollable-contents > ul"),
231231
$article = $content.find("article"),
232232
$breadcrumb = $content.find(".breadcrumb"),
233233
homeLink = $content.find(".logo > a").attr('href'),
234-
$navReplace = $(".bottom-left>ul"),
234+
$navReplace = $(".bottom-left .scrollable-contents > ul"),
235235

236236
//root elements - use .filter; not .find
237237
$pathPrefixDiv = $content.filter("[path-prefix]");

static/layout.less

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -67,11 +67,8 @@
6767
}
6868
.bottom-left {
6969
flex-grow: 1;
70-
overflow-y: auto;
71-
overflow-x: hidden;
72-
padding: @gutter*2;
73-
padding-bottom: 0;
7470
background: white;
71+
height: inherit;
7572
}
7673
.bottom-right {
7774
flex-grow: 1;

static/sidebar.less

Lines changed: 37 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -79,40 +79,48 @@ img.social-icon-small{
7979
color: darken(@link-color,10%);
8080
}
8181
// Highest parent level
82-
> ul {
83-
padding-left: 0;
84-
> li {
85-
list-style: none;
86-
list-style-type: none;
87-
padding: 0;
88-
.border-bottom;
89-
> a {
90-
font-size: 110%;
91-
padding-bottom: @gutter;
92-
padding-top: @gutter;
93-
}
94-
&.expanded > a {
95-
padding-bottom: @gutter/3;
96-
}
97-
// Second level
98-
> ul {
82+
.nav-menu {
83+
height: inherit;
84+
overflow-y: scroll;
85+
& > .scrollable-contents {
86+
padding: @gutter*2;
87+
& > ul {
88+
padding: 0;
89+
height: inherit;
9990
> li {
91+
list-style: none;
92+
list-style-type: none;
93+
padding: 0;
94+
.border-bottom;
10095
> a {
101-
padding-bottom: @gutter/3;
102-
padding-top: @gutter/3;
96+
font-size: 110%;
97+
padding-bottom: @gutter;
98+
padding-top: @gutter;
10399
}
104-
&.expanded {
105-
> a {
106-
padding-bottom: @gutter/2;
107-
margin-left: -1px;
108-
}
100+
&.expanded > a {
101+
padding-bottom: @gutter/3;
109102
}
110-
//Third level
103+
// Second level
111104
> ul {
112-
border-left: 1px solid @border-color;
113-
li {
114-
ul {
115-
margin-top: @gutter/3;
105+
> li {
106+
> a {
107+
padding-bottom: @gutter/3;
108+
padding-top: @gutter/3;
109+
}
110+
&.expanded {
111+
> a {
112+
padding-bottom: @gutter/2;
113+
margin-left: -1px;
114+
}
115+
}
116+
//Third level
117+
> ul {
118+
border-left: 1px solid @border-color;
119+
li {
120+
ul {
121+
margin-top: @gutter/3;
122+
}
123+
}
116124
}
117125
}
118126
}

templates/content.mustache

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,17 @@
66
{{/with}}
77
</div>
88
<div class="bottom-left">
9-
<div class="social-side-container">
10-
{{>social.mustache}}
9+
<div class="nav-menu">
10+
<div class="scrollable-contents">
11+
<div class="social-side-container">
12+
{{>social.mustache}}
13+
</div>
14+
{{#with (getCurrentTree)}}
15+
{{>menu.mustache}}
16+
{{/with}}
17+
</div>
1118
</div>
12-
{{#with (getCurrentTree)}}
13-
{{>menu.mustache}}
14-
{{/with}}
15-
{{>search-results.mustache}}
19+
{{>search-results.mustache}}
1620
</div>
1721
</div>
1822
<div id="right" class="column">

0 commit comments

Comments
 (0)