修改BUG:有子菜单的节点点击时,自动展开到不可见区域
This commit is contained in:
parent
2e333dd7bb
commit
8e6694c021
|
@ -23,9 +23,18 @@
|
|||
var top = arch.offset().top;
|
||||
if (top > 0) {
|
||||
var middle = $('header').outerHeight() + $sidebar.outerHeight() / 2;
|
||||
if (top > middle) $sidebar.animate({ scrollTop: top + arch.outerHeight() / 2 - middle }, 800);
|
||||
if (top > middle) $sidebar.animate({ scrollTop: top + arch.outerHeight() / 2 - middle }, 500);
|
||||
}
|
||||
|
||||
$sidebar.on('click', 'a.dcjq-parent', function () {
|
||||
var o = ($(this).offset());
|
||||
diff = 110 - o.top;
|
||||
if (diff > 0)
|
||||
$sidebar.scrollTo("-=" + Math.abs(diff), 500);
|
||||
else
|
||||
$sidebar.scrollTo("+=" + Math.abs(diff), 500);
|
||||
});
|
||||
|
||||
$('.sidebar-toggle-box').on('click', function () {
|
||||
if ($sidebar.is(":visible") === true) {
|
||||
$sidebar.hide();
|
||||
|
|
Loading…
Reference in New Issue