当文档滚动位置使用iron-scroll-threshold接近底部时,我想触发嵌套自定义元素的方法。
所以,我有一个像这样的index.html文件:
<link rel="import" href="/src/my-app.html">
<body>
<my-app></my-app>
</body>
</html>
在my-app元素中,我有像这样的my-questions元素:
<iron-pages
selected="[[page]]"
attr-for-selected="name"
fallback-selection="view404"
role="main">
<my-questions name="questions"></my-questions>
<my-view404 name="view404"></my-view404>
</iron-pages>
现在终于在my-questions元素中,我有
<ul id="question-list">
<template is="dom-repeat" items="[[questions]]" sort="_computeSort" as="question">
<poll-result questionkey="[[question.$key]]"></poll-result>
</template>
</ul>
<iron-scroll-threshold on-lower-threshold="_loadMoreQuestions" lower-threshold="400" id="threshold" lower-triggered="{{nearBottom}}" scroll-target="document">
</iron-scroll-threshold>
和我的loadMoreQuestions函数:
_loadMoreQuestions: function(){
console.log('load more questions fired');
var questionCount = this.$.questionQuery.limitToLast;
this.$.questionQuery.limitToLast = questionCount + 10;
var threshold=this.$.threshold;
threshold.clearTriggers();
},
现在,_loadMoreQuestions方法在加载页面时会触发一次,但不会再次触发。如果文档从底部滚动400px,我怎样才能触发此方法?