提交 296b4242 编写于 作者: EvanOne(文一)'s avatar EvanOne(文一)

refactor: Modify animation of heading

上级 a01c8cc7
.sidebar {
width: convert(hexo-config('sidebar.width') || '$sidebar-width');
&.sticky {
position: fixed;
top: convert(hexo-config('sidebar.offsetTop') || '30px');
z-index: $z-index0;
transform: translateZ(0);
}
.hide {
display: none;
}
......
......@@ -29,13 +29,6 @@
if (hexo-config('sidebar.enable')) {
.sidebar {
float: convert(hexo-config('sidebar.position'));
&.sticky {
position: fixed;
top: convert(hexo-config('sidebar.offsetTop') || '30px');
z-index: $z-index0;
transform: translateZ(0);
}
}
}
......
......@@ -131,7 +131,7 @@ $category-list-dot-color = $blue-light
$category-list-dot-hover-color = $orange-dark
$category-post-count-color = #99a9bf
$category-link-color = $blue-light
$category-link-hover-color = $blue-light
$category-link-hover-color = $orange-dark
// Tag page
$tag-hover-color = $orange-dark
......
......@@ -45,7 +45,10 @@ $(document).ready(function () {
function scrollHeadingToTop (anchor) {
$(anchor)
.velocity('stop')
.velocity('scroll', { easing: 'easeOutSine' });
.velocity('scroll', {
easing: 'ease-in-out',
duration: 600
});
}
var isBack2topShow = false;
......
......@@ -83,19 +83,21 @@ $(document).ready(function () {
// Distance from sidebar to top.
var SIDEBAR_STICKY_TOP = parseInt(CONFIG.sidebar.offsetTop);
var isSidebarSticky = false;
// Sticky the sidebar when it arrived the top.
function sidebarSticky () {
var targetY = $('#main')[0].getBoundingClientRect().top;
var $sidebar = $('#sidebar');
var targetY =
document.getElementById('main').getBoundingClientRect().top;
if (targetY < SIDEBAR_STICKY_TOP) {
if (!isSidebarSticky) {
$('#sidebar').addClass('sticky');
$sidebar.addClass('sticky');
isSidebarSticky = true;
}
} else {
if (isSidebarSticky) {
$('#sidebar').removeClass('sticky');
$sidebar.removeClass('sticky');
isSidebarSticky = false;
}
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册