如何找到模态已滚动到末尾-EmberJS

how to find modal has scrolled to the end -EmberJS

我是 emberJS 的新手,我想在模式滚动结束时启用一个按钮。所以我尝试了几种方法,但都没有用

查看

<div class="modal--dialog--body">

    <div class="app_tour--section--terms_container" id="message-container">

      <ul class="app_tour--section--ul">
        <li></li>
           //so many lists to scroll
        <li></li>
     </ul>
</div>

控制器

 import Ember from 'ember';
export default Ember.Controller.extend({

  didTransition() {
    Ember.run.later('afterRender', () => {
      let objDiv = document.getElementById("message-container");
      if(objDiv.scrollTop == objDiv.scrollHeight)
      console.log(objDiv.scrollTop)
    }, 100);
    return true;
  },


  actions: {

    close: function() {

      this.send('closeModal');
    }
  }
});

欢迎开始使用 Ember!像许多事情一样,有一个非常有用的插件可以让你的生活更简单:https://github.com/alphasights/ember-scrollable

它提供了一个可滚动容器,并在您到达滚动底部时显示一个动作。

{#ember-scrollable onScrolledToBottom=(action "close")}}
  add terms and consitions here
{{/ember-scrollable}}

我使用基本的 jQuery 来获取我定位的 DOM 元素,并在 Rechardo 的帮助下监听滚动事件并且成功了。 你可以通过她 post 在 medium

上查看

https://medium.com/@futoricky/ember-js-detect-scrolling-events-on-html-element-using-component-ac6b2630021a