Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(back-to-top): update back-to-top IXD #318

Merged
merged 4 commits into from
Apr 26, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion layout/_partial/footer_top.ejs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<div class="toTop-wrap">
<div id="back-to-top" class="toTop-wrap">
<a href="#top" class="toTop">
<i class="material-icons footer_top-i">expand_less</i>
</a>
Expand Down
25 changes: 20 additions & 5 deletions source/css/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -2425,16 +2425,31 @@ a {
/* Footer_Top */
/**************/

.toTop-wrap {
#back-to-top{
display: block;
position: fixed;
bottom: 24px;
right: -41px;
transition: background-color .18s cubic-bezier(.6,0,.1,1),box-shadow .18s cubic-bezier(.6,0,.1,1),transform .18s cubic-bezier(.6,0,.1,1);
z-index: 8;
}
#back-to-top.btt-visible{
transform: translate(-64px, 0);
}
#back-to-top.btt-docked{
position: absolute;
bottom: 100px;
right: 34.61px;
z-index: 8
}
@media screen and (max-width: 840px) {
.toTop-wrap {
#back-to-top{
bottom: 24px;
}
#back-to-top.btt-visible{
transform: translate(-60px, 0);
}
#back-to-top.btt-docked{
position: absolute;
bottom: 180px;
right: 28px
}
}
.toTop {
Expand Down
2 changes: 1 addition & 1 deletion source/css/style.min.css

Large diffs are not rendered by default.

20 changes: 18 additions & 2 deletions source/js/js.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
/*global $, jQuery, alert*/

// Custom_js
// Active_Toc_js
// Back_to_top_js
// Material_js
// Bootstrap_js
// Sidebar_js
Expand Down Expand Up @@ -92,10 +92,26 @@ $(document).ready(function() {

//**********************************
//**********************************
//********************************** Active_Toc_js
//********************************** Back_to_top_js
//**********************************
//**********************************

$(window).scroll(function (event) {
var scroll = $(window).scrollTop();
if (scroll > 300) {
$('#back-to-top').addClass('btt-visible');
} else {
$('#back-to-top').removeClass('btt-visible');
}

var footerOffset = $('.mdl-mini-footer').offset().top;
var windowHeight = $( window ).height();
if (scroll > footerOffset - windowHeight + 42) {
$('#back-to-top').addClass('btt-docked');
} else {
$('#back-to-top').removeClass('btt-docked');
}
});

//**********************************
//**********************************
Expand Down
2 changes: 1 addition & 1 deletion source/js/js.min.js

Large diffs are not rendered by default.