Change Twitter Widget Profile Dynamically?
|
11-10-2012, 12:16 AM
Post: #1
|
|||
|
|||
Change Twitter Widget Profile Dynamically?
I'm using a standard twitter profile widget and trying to figure out a way to change the profile after the page has rendered.
The last line of the widget is as follows: }).render().setUser(document.getElementById("USER_NAME_HERE").value).start(); Is it possible to update the USER_NAME_HERE field on the fly? For example, if I wanted a random one profile of five possible to appear on the page, I know how to select the random one, but can't figure out how to get it to update with the result. Thanks in advance. FYI here is the link to the create a widget page: http://twitter.com/about/resources/widge...et_profile Ads |
|||
11-10-2012, 12:25 AM
Post: #2
|
|||
|
|||
Try this code.
<div id="my_widget_region"> <script src="http:// widgets.twimg.com/j/2/ widget.js"></script> <script>do_twitter_widget('"# winning" or "justin bieber"');</ script> </div> function do_twitter_widget (search_query, title, subtitle) { if (!window.widgetRef) { window.widgetRef = new TWTR.Widget({ version: 2, type: 'search', search: search_query, interval: 6000, title: title || 'Tweets related to', subject: subtitle || search_ query, width: 'auto', height: 500, theme: { shell: { background: '#8EC1DA', color: '#FFFFFF' }, tweets: { background: '#FFFFFF', color: '#444444', links: '#1985B5' } }, features: { scrollbar: false, loop: true, live: true, hashtags: true, timestamp: true, avatars: true, behavior: 'default' }, ready: function() { // when done rendering... } }); window.widgetRef .render() .start(); } else { if (search_query != window.old_twitter_search) { window.widgetRef .stop() .setSearch(search_query) .setTitle(title || 'Tweets related to') .setCaption(subtitle || search_query) .render() .start(); } } window.old_twitter_search = search_query; return window.widgetRef; } Ads |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 1 Guest(s)