Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums JavaScript jQuery plugin callback and ‘this’ Re: jQuery plugin callback and ‘this’

#131072
CrocoDillon
Participant

Reduced function (only positive offset):

function checkNumber(){
current_number += offset;
if(current_number >= settings.countTo) {
current_number = settings.countTo;
if (typeof settings.onFinished == ‘function’) {
settings.onFinished();
}
} else {
timer=window.setTimeout(function(){checkNumber()},settings.frequency);
}
settings.target.html(current_number);
}

EDIT: Aaah you got it already :) cheers!