javascript - How to update a twitter widget in meteor without reloading the page? -
i new meteor. have template associate specific question specific twitter timeline widget. got data ({{question}},{{questionanwser}},{{tweetid}}) iron router data function.
the twitter widget load on first question. can switch between questions clicking on button , content correctly updated, twitter widget not change. can update widget correct twitterid if reload page.
question.html:
<template name="question"> <h3>{{question}}:</h3> <p>{{questionanwser}}</p> {{> twitter}} </template>
twitter.html:
<template name="twitter"> <a class="twitter-timeline" href="https://twitter.com/hashtag/test" data-widget-id="{{tweetid}}"> tweets </a> </template>
twitter.js:
template.twitter.onrendered(function(){ ! function (d, s, id) { var js, fjs = d.getelementsbytagname(s)[0]; if (!d.getelementbyid(id)) { js = d.createelement(s); js.id = id; js.src = "https://platform.twitter.com/widgets.js"; fjs.parentnode.insertbefore(js, fjs); } }(document, "script", "twitter-wjs"); });
i have tried several things in order make widget update without reload of page nothing have worked far. on twitter developers page, suggest use twttr.widgets.load()
but not sure how use in specific configuration. have try make onrendered template reactive including this.autorun
session.get
didn't work.
what best way achieve this?
Comments
Post a Comment