修复滚动条BUG

This commit is contained in:
fofolee 2019-12-24 10:00:53 +08:00
parent fcbb15455b
commit 02b6fa9cce
5 changed files with 32 additions and 24 deletions

BIN
.DS_Store vendored

Binary file not shown.

BIN
assets/.DS_Store vendored

Binary file not shown.

View File

@ -97,8 +97,12 @@ highlightManual = (selector, text) => {
// 初始化 // 初始化
scrollInit = () => { scrollInit = () => {
$("html").niceScroll(); $("html").niceScroll({
$("#manual").niceScroll(); enablekeyboard: false
});
$("#manual").niceScroll({
enablekeyboard: true
});
} }
// 向活动窗口发送文本 // 向活动窗口发送文本
@ -327,33 +331,37 @@ $(document).keydown(e => {
break; break;
// 上 // 上
case 38: case 38:
if ($('#manual').is(':hidden') && $("#mainlist").is(":visible")) {
let pre = $(".select").prev(); let pre = $(".select").prev();
// 没有到达边界时移动选择条 // 没有到达边界时移动选择条
if(pre.length != 0){ if (pre.length != 0) {
if(pre.offset().top < $(window).scrollTop()){ if (pre.offset().top < $(window).scrollTop()) {
$("html").animate({ scrollTop: "-=50" }, 0); $("html").animate({ scrollTop: "-=50" }, 0);
} }
pre.addClass("select"); pre.addClass("select");
$(".select:last").removeClass("select"); $(".select:last").removeClass("select");
// 到达边界闪烁移动选择条 // 到达边界闪烁移动选择条
}else{ } else {
$(".select").animate({"opacity":"0.3"}).delay(500).animate({"opacity":"1"}) $(".select").animate({ "opacity": "0.3" }).delay(500).animate({ "opacity": "1" })
}
} }
break; break;
// 下 // 下
case 40: case 40:
if ($('#manual').is(':hidden') && $("#mainlist").is(":visible")) {
let next = $(".select").next(); let next = $(".select").next();
// 没有到达边界时移动选择条 // 没有到达边界时移动选择条
if(next.length !=0){ if (next.length != 0) {
if(next.offset().top >= $(window).scrollTop() + 550){ if (next.offset().top >= $(window).scrollTop() + 550) {
$("html").animate({ scrollTop: "+=50" }, 0); $("html").animate({ scrollTop: "+=50" }, 0);
} }
loadList(300); loadList(300);
next.addClass("select"); next.addClass("select");
$(".select:first").removeClass("select"); $(".select:first").removeClass("select");
// 到达边界闪烁移动选择条 // 到达边界闪烁移动选择条
}else{ } else {
$(".select").animate({"opacity":"0.3"}).delay(500).animate({"opacity":"1"}) $(".select").animate({ "opacity": "0.3" }).delay(500).animate({ "opacity": "1" })
}
} }
break; break;
} }

BIN
docs/.DS_Store vendored

Binary file not shown.

View File

@ -28,7 +28,7 @@ dirname = __dirname;
isWin = process.platform == 'win32' ? true : false; isWin = process.platform == 'win32' ? true : false;
openFolder = () => { openFolder = () => {
return dialog.showOpenDialog(BrowserWindow.getFocusedWindow(), { return dialog.showOpenDialogSync(BrowserWindow.getFocusedWindow(), {
buttonLabel: '选择', buttonLabel: '选择',
properties: ['openDirectory'] properties: ['openDirectory']
}); });