Skip to content

Instantly share code, notes, and snippets.

View szz1204233's full-sized avatar

szz1204 szz1204233

View GitHub Profile
@WarningImHack3r
WarningImHack3r / OS_arch.md
Last active January 6, 2026 14:11
Offline installation of local language models of IntelliJ 2024.1+

Available OS: windows, linux (probably darwin for macOS, not tested though)
Available arch: x86_64 (others not tested)

Note: You can try to mix and match values from both lists above, there is no guarantee of success though, even though it should very likely work.

@337547038
337547038 / js获取滚动条的宽度
Created April 23, 2018 09:50
js获取滚动条的宽度
判断滚动条的需求在弹窗插件中使用比较多,当弹窗添加overflow: hidden时,如果页面比较长的话,添加这个属性之后页面会有晃动。
为了增强用户体验,通过判断是否有滚动条而添加 margin-left 属性以抵消 overflow: hidden 之后的滚动条位置。
判断是否有滚动条的方法
function hasScrollbar() {
return document.body.scrollHeight > (window.innerHeight || document.documentElement.clientHeight);
}
计算滚动条宽度的方法
新建一个带有滚动条的 div 元素,通过该元素的 offsetWidth 和 clientWidth 的差值即可获得