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

refactor: Modify animation of heading

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