简体   繁体   中英

Enable/disable scrolling on button click

Is there a simple way to do this? I have a website with a flip animation(on buttonclick), wich has two sides. The frontpage has to cover the viewport height and width. The backpage is a little longer, especially on mobile devices. Unfortunately the length of the backpage causes the frontpage to be the same height. So i have a grey background color area underneath the cover of the frontpage..

My idea was to make the flip button also enable and disable scrolling. I've tried some things but javascript and jquery are not my specialty(at all). So can somebody provide me a little piece of code to add to the flipbutton?

我想您可以设置溢出:单击该按钮时,您不想停止滚动的div(或主体)上的任何溢出。

You'll need to set this on the click event:

body {
 overflow: hidden;
}

Here's an example.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM