【问题标题】:All Twitter tweets on page rendered event/callback页面上的所有 Twitter 推文呈现事件/回调
【发布时间】:2015-05-23 01:36:13
【问题描述】:

我正在处理这个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' 事件将为每条推文单独触发,是否有适当的方法在页面上的所有嵌入推文被渲染/显示时得到通知

【问题讨论】:

    标签: javascript jquery twitter tweets


    【解决方案1】:

    好的,我找到了合适的解决方案。您需要收听'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);
        });
    });
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2011-06-24
      • 1970-01-01
      • 2021-04-06
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-01-22
      相关资源
      最近更新 更多