我正在使用此code。
twttr.ready(function (twttr) {
// At this point the widget.js file had been loaded.
// We can now make use of the twttr events
twttr.events.bind('rendered', function (event) {
// At this point the tweet as been fully loaded
// and rendered and you we can proceed with our Javascript
console.log("Created widget", event.target.id);
});
});
不幸的是,“渲染”事件将针对每个推文单独触发,当页面上所有嵌入的推文都被渲染/显示时,是否有适当的方式通知您?
最佳答案
好的,我找到了正确的解决方案。您需要监听'loaded' event,仅在显示所有tweet widgedts之后才会触发。
twttr.ready(function (twttr) {
// At this point the widget.js file had been loaded.
// We can now make use of the twttr events
twttr.events.bind('loaded', function (event) {
// At this point all tweets have been fully loaded
// and rendered and you we can proceed with our Javascript
console.log("Created widget", event.target.id);
});
});