Enable Stickyfill on screen width > 768px
This commit is contained in:
parent
e72642539e
commit
f85dd7aee2
8 changed files with 34 additions and 12 deletions
|
@ -6,6 +6,8 @@
|
||||||
margin-bottom: 2em;
|
margin-bottom: 2em;
|
||||||
@include breakpoint($medium) {
|
@include breakpoint($medium) {
|
||||||
@include span(10 of 12 last);
|
@include span(10 of 12 last);
|
||||||
|
}
|
||||||
|
@include breakpoint($large) {
|
||||||
@include suffix(3 of 12);
|
@include suffix(3 of 12);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
#main {
|
#main {
|
||||||
@include container;
|
@include container;
|
||||||
@include clearfix;
|
@include clearfix;
|
||||||
|
position: relative;
|
||||||
margin-top: 2em;
|
margin-top: 2em;
|
||||||
padding-left: 2em;
|
padding-left: 2em;
|
||||||
padding-right: 2em;
|
padding-right: 2em;
|
||||||
|
@ -13,6 +14,8 @@
|
||||||
.page {
|
.page {
|
||||||
@include breakpoint($medium) {
|
@include breakpoint($medium) {
|
||||||
@include span(10 of 12 last);
|
@include span(10 of 12 last);
|
||||||
|
}
|
||||||
|
@include breakpoint($large) {
|
||||||
padding-right: $right-sidebar-width;
|
padding-right: $right-sidebar-width;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -23,7 +26,6 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
.page__content {
|
.page__content {
|
||||||
position: relative;
|
|
||||||
p, li {
|
p, li {
|
||||||
font-size: 16px;
|
font-size: 16px;
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,15 +9,15 @@
|
||||||
text-transform: uppercase;
|
text-transform: uppercase;
|
||||||
letter-spacing: 1px;
|
letter-spacing: 1px;
|
||||||
background-color: #fff;
|
background-color: #fff;
|
||||||
&.sticky {
|
// &.sticky {
|
||||||
@include breakpoint($large) {
|
@include breakpoint($large) {
|
||||||
position: fixed;
|
position: absolute;
|
||||||
top: 0;
|
top: 0;
|
||||||
right: calc(50% - 512px + 2em); // 50% - 1/2 of wrapper's max-width + wrapper padding
|
right: calc(50% - 512px + 2em); // 50% - 1/2 of wrapper's max-width + wrapper padding
|
||||||
width: $right-sidebar-width;
|
width: $right-sidebar-width;
|
||||||
padding-left: 2em;
|
padding-left: 2em;
|
||||||
}
|
}
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
.toc__title {
|
.toc__title {
|
||||||
|
|
|
@ -157,10 +157,7 @@ body:hover .visually-hidden button {
|
||||||
========================================================================== */
|
========================================================================== */
|
||||||
|
|
||||||
.sticky {
|
.sticky {
|
||||||
> * {
|
@include breakpoint($medium) {
|
||||||
display: none;
|
|
||||||
}
|
|
||||||
@include breakpoint($small) {
|
|
||||||
@include clearfix();
|
@include clearfix();
|
||||||
position: -webkit-sticky;
|
position: -webkit-sticky;
|
||||||
position: sticky;
|
position: sticky;
|
||||||
|
|
|
@ -10,6 +10,27 @@ $(document).ready(function(){
|
||||||
// init sticky sidebar
|
// init sticky sidebar
|
||||||
$(".sticky").Stickyfill();
|
$(".sticky").Stickyfill();
|
||||||
|
|
||||||
|
var stickySideBar = function(){
|
||||||
|
var windowWidth = $(window).width();
|
||||||
|
if (windowWidth > 768) {
|
||||||
|
// fix
|
||||||
|
Stickyfill.rebuild();
|
||||||
|
Stickyfill.init();
|
||||||
|
} else {
|
||||||
|
// unfix
|
||||||
|
Stickyfill.stop();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
stickySideBar();
|
||||||
|
|
||||||
|
$(window).resize(function(){
|
||||||
|
stickySideBar();
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// init smooth scroll
|
// init smooth scroll
|
||||||
$("a").smoothScroll({offset: -20});
|
$("a").smoothScroll({offset: -20});
|
||||||
|
|
||||||
|
|
|
@ -35,7 +35,7 @@ layout: compress
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
<div id="main" role="main">
|
<div id="main" role="main">
|
||||||
<div class="sidebar">
|
<div class="sidebar sticky">
|
||||||
{% if page.author_profile %}{% include author-profile.html %}{% endif %}
|
{% if page.author_profile %}{% include author-profile.html %}{% endif %}
|
||||||
{% if page.sidebar %}
|
{% if page.sidebar %}
|
||||||
{% for s in page.sidebar %}
|
{% for s in page.sidebar %}
|
||||||
|
|
File diff suppressed because one or more lines are too long
4
assets/js/main.min.js
vendored
4
assets/js/main.min.js
vendored
File diff suppressed because one or more lines are too long
Loading…
Reference in a new issue