search

Home  >  Q&A  >  body text

javascript - The default page has scroll bars. When the pop-up layer appears, how can I hide the original scroll bar and make the pop-up content scrollable?

On the mobile phone page, the default body content is a lot, with scroll bars. When a pop-up layer appears when clicked, the body content cannot be scrolled, but the pop-up layer can be scrolled! How to deal with it?

phpcn_u1582phpcn_u15822779 days ago505

reply all(4)I'll reply

  • ringa_lee

    ringa_lee2017-05-18 11:02:54

    It seems that there is no need to set anything separately. When the pop-up layer appears, set the original content to overflow and hide, the pop-up layer will overflow automatically, and the opposite will be true when closing it

    reply
    0
  • 大家讲道理

    大家讲道理2017-05-18 11:02:54

    You can prevent bubbling in the scroll event of the popup layerevent.stopPropagation(). Then when scrolling the pop-up layer, the external scroll event will not be triggered.

    $(".pop_box").on("touchmove",function(event){
        event.stopPropagation()
    })
    

    reply
    0
  • 習慣沉默

    習慣沉默2017-05-18 11:02:54

    You can try the modal box of bootstrap. It seems that the pop-up layer of the modal box can be scrolled, but the body cannot.

    reply
    0
  • PHP中文网

    PHP中文网2017-05-18 11:02:54

    Set the width and height of the body to 100% and overflow: hidden; the popup layer overflow: auto; should be fine

    reply
    0
  • Cancelreply