mirror of
https://github.com/HIllya51/LunaTranslator.git
synced 2024-12-28 08:04:13 +08:00
resz
This commit is contained in:
parent
f37f8c664c
commit
98fe465e95
32
docs/main.js
32
docs/main.js
@ -38,7 +38,35 @@ window.$docsify = {
|
||||
},
|
||||
|
||||
executeScript: true,
|
||||
|
||||
plugins: [
|
||||
function (hook, vm) {
|
||||
hook.doneEach(() => {
|
||||
var sidebar = document.getElementsByClassName("sidebar")[0];
|
||||
var resizeBar = document.createElement('div');
|
||||
resizeBar.classList.add('sidebarresizer')
|
||||
sidebar.appendChild(resizeBar);
|
||||
|
||||
var startX, startWidth;
|
||||
resizeBar.addEventListener('mousedown', function (e) {
|
||||
startX = e.clientX;
|
||||
startWidth = sidebar.offsetWidth;
|
||||
e.preventDefault();
|
||||
});
|
||||
|
||||
document.addEventListener('mousemove', function (e) {
|
||||
if (startX) {
|
||||
var newWidth = startWidth + (e.clientX - startX);
|
||||
document.documentElement.style.setProperty('--sidebar-width', sidebar.style.width);
|
||||
sidebar.style.width = Math.max(200, newWidth) + 'px';
|
||||
}
|
||||
});
|
||||
|
||||
document.addEventListener('mouseup', function () {
|
||||
startX = null;
|
||||
});
|
||||
})
|
||||
},
|
||||
]
|
||||
}
|
||||
|
||||
let dropdowns = document.getElementsByClassName('dropdown')
|
||||
@ -112,4 +140,4 @@ window.onpopstate = function (event) {
|
||||
|
||||
}
|
||||
}
|
||||
};
|
||||
};
|
||||
|
@ -108,6 +108,15 @@
|
||||
top: 50px;
|
||||
}
|
||||
|
||||
.sidebarresizer {
|
||||
width: 5px;
|
||||
height: 100%;
|
||||
position: absolute;
|
||||
right: 0;
|
||||
top: 0;
|
||||
cursor: ew-resize;
|
||||
}
|
||||
|
||||
.github-corner {
|
||||
position: fixed;
|
||||
top: 50px;
|
||||
|
Loading…
x
Reference in New Issue
Block a user