Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Updated to deal with multiple elements.

Credit to tangphillip.
  • Loading branch information...
commit 61d3bc32a676cfc5cbd1548e3f2341a1d92ea5fc 1 parent 63ab5d0
@scotthovestadt authored
Showing with 11 additions and 6 deletions.
  1. +11 −6 jquery.timeago.js
View
17 jquery.timeago.js
@@ -113,12 +113,17 @@
var $s = $t.settings;
if ($s.refreshMillis > 0) {
- var intervalID = setInterval(function() {
- // Do not continue refresh if the element is no longer attached to the DOM.
- if(self.parents(':last').is('html') == false) {
- clearInterval(intervalID);
- } else {
- self.each(refresh);
+ var intervalId = setInterval(function() {
+ var destroyed = 0;
+ self.each(function() {
+ if($(this).parents(":last").is("html") == false) {
+ destroyed++;
+ } else {
+ Function.call(this, refresh);
+ }
+ });
+ if (destroyed === self.length) {
+ clearInterval(intervalId);
}
}, $s.refreshMillis);
}
Please sign in to comment.
Something went wrong with that request. Please try again.