Commit d52ad010 authored by YASUTAKE Kiyoshi's avatar YASUTAKE Kiyoshi
Browse files

Merge pull request #13 from key-amb/maint

Fix #11, #12
parents c1b54635 faef4a7e
......@@ -3,7 +3,7 @@
<div class="row">
<div class="col-sm-8">
<p class="doc-footer-em"><a href="#">Back to TOP</a></p>
<p class="doc-footer-em"><a href="#" onclick="resetSidebarPos()">Back to TOP</a></p>
</div>
</div>
......
......@@ -190,7 +190,6 @@ main > article > section > table > tbody > tr:nth-of-type(odd) {
*/
div#sidebar {
position: fixed;
}
/* Sidebar modules for boxing content */
......
......@@ -6,9 +6,12 @@ window.onload = function() {
var totalHeight = headHeight + mainHeight + footHeight;
var w = $(window);
if (sideHeight > 0 && sideHeight < mainHeight) {
if ( w.width() > $("main").width() + $("#sidebar").width()
&& sideHeight > 0
&& sideHeight < mainHeight ) {
$(".doc-sidebar").css("height", mainHeight);
var sideNode = $("#sidebar");
sideNode.css({"position": "fixed"});
var scrollStart = 0;
var scrollStop = headHeight + mainHeight - sideHeight;
......@@ -16,7 +19,7 @@ window.onload = function() {
if (w.scrollTop() <= scrollStart) {
sideNode.css({"position": "fixed"});
} else if (scrollStart < w.scrollTop() && w.scrollTop() < scrollStop) {
sideNode.css({"position": "fixed", "top": headHeight + "px"});
sideNode.css({"position": "fixed", "top": headHeight + 20 + "px"});
} else if (w.scrollTop() >= scrollStop) {
var topNext
= headHeight - (headHeight + sideHeight)
......@@ -26,5 +29,12 @@ window.onload = function() {
});
}
});
}
}
}
function resetSidebarPos() {
var sideNode = $("#sidebar");
if ( $(window).width() > $("main").width() + $("#sidebar").width() ) {
sideNode.css({"position": "fixed", "top": "", "bottom": ""});
}
}
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment