# Stop propagating scroll events when modal dialogs are visible or scrollable popups have focus

**URL:** <https://meta.discourse.org/t/stop-propagating-scroll-events-when-modal-dialogs-are-visible-or-scrollable-popups-have-focus/33264>\
**Category:** UX\
**Created:** [2015 年9 月 14 日 23:25 UTC](https://meta.discourse.org/t/stop-propagating-scroll-events-when-modal-dialogs-are-visible-or-scrollable-popups-have-focus/33264 "2015-09-14T23:25:17Z")\
**Posts on this page:** 1\
**Showing post:** 5

<div class="post-metadata">

作者： ![simon](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/simon/32/339122_2.png) [@simon](https://meta.discourse.org/u/simon)\
发布日期： [2015 年9 月 16 日 03:27 UTC](https://meta.discourse.org/t/stop-propagating-scroll-events-when-modal-dialogs-are-visible-or-scrollable-popups-have-focus/33264/5 "2015-09-16T03:27:43Z")

</div>

You can get an idea of how it could work by adding something like this to menu-panel.js.es6. This doesn’t take care of touch events and is resetting the body height incorrectly. It only stops the scrolling on the body if the menu has a scrollbar.

```js
  mouseEnter() {
    let height = $(window).height();
    let contentHeight = parseInt(this.$('.panel-body-contents').height());
    let menuHeight = this.$().height();
    if (contentHeight > menuHeight) {
      $('body').css({
        'overflow': 'hidden',
        'height': height
      });
    }
  },

  mouseLeave() {
    $('body').css({
      'overflow': 'visible',
      'height': 'auto',
    });
  },

```

---

_[View the full topic](https://meta.discourse.org/t/stop-propagating-scroll-events-when-modal-dialogs-are-visible-or-scrollable-popups-have-focus/33264)._
