-
demo.mp4Hi, I am using a plugin to disable X-axis horizontal scrolling totally, but sometimes accidentally when I hold and drag from the right edge, the site starts horizontally dragging. You can check the video and can try it out also here https://haspr.in/ This is the Plugin
|
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 7 replies
-
Oh, that's because we forget to make the scrolling .layout {
/* height: 100vh; <- not sure why you wrote this but it seems safe to delete it */
background: #fff;
overflow: hidden; /* add this */
} Edit: you also need to recalculate the floating contact button's position to avoid overflow: |
Beta Was this translation helpful? Give feedback.
-
html,
body {
overflow: hidden;
position: relative;
height: 100%;
}
/*
if safari
*/
body.lock-scroll {
position: fixed;
inset: 0; /* https://caniuse.com/?search=inset */
top: 0;
left: 0;
}
html, body {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
margin: 0;
padding: 0;
color: #555;
font-size: 16px;
font-family: 'Hiragino Sans GB', 'Microsoft YaHei', 'WenQuanYi Micro Hei', sans-serif;
} position fixed on both html, body can be used to solve overflow problems, but It may disrupt the gsap ScrollTrigger function without set ScrollTrigger default const scroller = document.querySelector("#main-scrollbar")
ScrollTrigger.defaults({ scroller }); |
Beta Was this translation helpful? Give feedback.
Oh, that's because we forget to make the scrolling
delta
fromselect
events transformable 🤦♂️. That's surely a bug, but I think we can get rid of the horizontal scrollbars with several lines of CSS, and you won't need a plugin anymore:Edit: you also need to recalculate the floating contact button's position to avoid overflow:
bottom = scrollbar.limit.y - scrollbar.offset.y
. Here is a helper function for fixed elements: https://codesandbox.io/s/smooth-scrollbar-fixed-element-ki0syo?file=/src/fixed-element.ts