jquerysifr

sIFR and jQuery: dynamically replacing text


I have a problem. I would like to update a counter (seen by the user as it's displayed in a certain div) when a button is pressed. So this happens when the button is pressed:

$("#photo-counter span").empty().append((start_index+1)+"-"+(end_index+1)+" / "+files.length);  
sIFR.replace(netto, { selector: "#photo-counter span"});

As on the first time this runs automatically and everything works fine, but when I click the button the div is not replaced by sIFR.

Can anybody help?


Solution

  • You can actually do this:

    sIFR.replacements["#photo-counter span"][0].replaceText((start_index+1)+"-"+(end_index+1)+" / "+files.length);
    

    No need to update the HTML, sIFR takes care of all that for you.