Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Make things work as expected when calling .tweet() multiple times on …

…the same element (fixes #178)
  • Loading branch information...
commit 04351bbd2a68b3b0f474866513d09c46a94f15da 1 parent e89365b
@purcell purcell authored
Showing with 3 additions and 3 deletions.
  1. +3 −3 tweet/jquery.tweet.js
View
6 tweet/jquery.tweet.js
@@ -182,7 +182,7 @@
}
return this.each(function(i, widget){
- var list = $('<ul class="tweet_list">').appendTo(widget);
+ var list = $('<ul class="tweet_list">');
var intro = '<p class="tweet_intro">'+s.intro_text+'</p>';
var outro = '<p class="tweet_outro">'+s.outro_text+'</p>';
var loading = $('<p class="loading">'+s.loading_text+'</p>');
@@ -191,10 +191,10 @@
s.username = [s.username];
}
- if (s.loading_text) $(widget).append(loading);
$(widget).bind("tweet:load", function(){
+ if (s.loading_text) $(widget).empty().append(loading);
$.getJSON(build_api_url(), function(data){
- if (s.loading_text) loading.remove();
+ $(widget).empty().append(list);
if (s.intro_text) list.before(intro);
list.empty();
Please sign in to comment.
Something went wrong with that request. Please try again.