views:

371

answers:

3

is it possible to make sifr re-run or update again without having to refreshing the page??

Id imagine there is a function like sifr() or something..?

A: 

Which version of sIFR? At least sIFR 3 has a method for this:

sIFR.redraw();
kkyy
A: 

You are spot on: There is a function, called sIFR().

The Javascript replacement statements can be added in the sifr.js file, or at the end of your (X)HTML file.

When you put the replacement code in the sIFR Javascript file, it’ll execute on onload (depending on if sIFR.bAutoInit is set to True, which is the default value) or when you call sIFR(). If you put the replace statements in the body, they'll be executed immediately.

Effectively, this means that you could put the replacement statement in the JavaScript and call sIFR() in the body. It won't make any difference.

To save bandwidth you can put the replace statements in the JavaScript file, and then call sIFR() in the body. The exact code you have to use in the body in this case is:

<script type="text/javascript">
if(typeof sIFR == "function"){
    sIFR();
};
</script>

Obviously you could call this function later again, e.g when something has changed asynchronously.

Sidenote: I wasn't aware of the redraw() function opted by Simon. Obviously I would give that a go, if I where you.

gijswijs
A: 

thanks guys. unfortunately for me its version 2.0.7. I'll have to let the front end designers know to update sifr for future markups. I havnt got time to play with this anymore as there is more important things on the project.

I tried the whole sIFR() thing, but didn't work, looks like ill have to refresh the page everytime the user switches themes. Or if i get time towards the end ill update it to v3 and try the redraw().

byron