views:

270

answers:

1

Hey all, I'm using this code to change my sIFR (version 3) H1 and H2 tags dynamically (thanks to Mark Wubben for the code), but I need to change my H2 background color in the same function.. Can anyone help me get the code working? Apparently sIFR and changeCSS doesn't work for background colors..

function changeColor(hexValue) {

var css1 = '.sIFR-root { color: '+ hexValue +'; }';
var css2 = '.sIFR-root { color: #080808; background-color: '+hexValue+'; }';

for (var i = 0; i < sIFR.replacements['h1'].length; i++) {
 sIFR.replacements['h1'][i].changeCSS(css1);
};

for (var i = 0; i < sIFR.replacements['h2'].length; i++) {
 sIFR.replacements['h2'][i].changeCSS(css2);
};

};

+1  A: 

sIFR only supports a background color for the entire Flash movie, and this can't be changed later.

Your best bet is to enable transparency for the replacements, and set the background color on the HTML element replaced by sIFR (the <h2>). You're advised however to use transparency only when strictly necessary, and please keep in mind that transparency is largely unsupported on Linux. It will fall back to the specified background-color instead.

Mark Wubben
Thanks for your help, will try regular CSS :)
SoulieBaby