呈现页面上的所有 Twitter 推文 event/callback

All Twitter tweets on page rendered event/callback

我正在使用这个 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);
    });
});

不幸的是,'rendered' 事件将针对每条推文单独触发,是否有适当的方法在页面上所有 嵌入的推文都被通知时收到通知? rendered/displayed?

好的,我找到了合适的解决方案。您需要监听 'loaded' event,只有在显示所有推文小部件后才会触发。

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);
    });
});