Post by Peter on Apr 29, 2006 13:32:21 GMT
Seems to be asked a lot, so maybe one should be added in here
Pretty simple to use, i'll post the code first then explain what needs to be changed...
<script type="text/javascript">
<!--
// Different gradients for different skins
// Global header
var cssSkin = [];
// Skin 1
cssSkin["1"] = [
["titlebg", "URL HERE"],
["catbg", "URL HERE"],
["menubg", "URL HERE"],
["newstitlebg", "URL HERE"]
]
// Skin 2
cssSkin["2"] = [
["titlebg", "URL HERE"],
["catbg", "URL HERE"],
["menubg", "URL HERE"],
["newstitlebg", "URL HERE"]
];
var iSheet = document.styleSheets.item(0);
var isIE = (document.all)? true : false;
if(iSheet){
if(cssSkin[pb_skinid]){
for(s = 0; s < cssSkin[pb_skinid].length; s ++){
var tRule = "." + cssSkin[pb_skinid][0];
var tVal = cssSkin[pb_skinid][1];
if(isIE){
iSheet.addRule(tRule, "background-image: url(" + tVal + ")");
} else {
iSheet.insertRule(tRule + "{" + "background-image: url(" + tVal + ")}", 0);
}
}
}
}
//-->
</script>
That goes into your global header.
See where it says "URL HERE", that is where you add the urls to the gradients, so far it allows you to customise the gradients for 2 skins, if you need to add more just another another one of these below the other 2....
// Skin 2
cssSkin["3"] = [
["titlebg", "URL HERE"],
["catbg", "URL HERE"],
["menubg", "URL HERE"],
["newstitlebg", "URL HERE"]
];
Only thing you need to change is the number that is in bold, that is the skin id number. It is also important to note that there is a comma after each line apart from the last one.
Pretty simple to use, i'll post the code first then explain what needs to be changed...
<script type="text/javascript">
<!--
// Different gradients for different skins
// Global header
var cssSkin = [];
// Skin 1
cssSkin["1"] = [
["titlebg", "URL HERE"],
["catbg", "URL HERE"],
["menubg", "URL HERE"],
["newstitlebg", "URL HERE"]
]
// Skin 2
cssSkin["2"] = [
["titlebg", "URL HERE"],
["catbg", "URL HERE"],
["menubg", "URL HERE"],
["newstitlebg", "URL HERE"]
];
var iSheet = document.styleSheets.item(0);
var isIE = (document.all)? true : false;
if(iSheet){
if(cssSkin[pb_skinid]){
for(s = 0; s < cssSkin[pb_skinid].length; s ++){
var tRule = "." + cssSkin[pb_skinid]
var tVal = cssSkin[pb_skinid]
if(isIE){
iSheet.addRule(tRule, "background-image: url(" + tVal + ")");
} else {
iSheet.insertRule(tRule + "{" + "background-image: url(" + tVal + ")}", 0);
}
}
}
}
//-->
</script>
That goes into your global header.
See where it says "URL HERE", that is where you add the urls to the gradients, so far it allows you to customise the gradients for 2 skins, if you need to add more just another another one of these below the other 2....
// Skin 2
cssSkin["3"] = [
["titlebg", "URL HERE"],
["catbg", "URL HERE"],
["menubg", "URL HERE"],
["newstitlebg", "URL HERE"]
];
Only thing you need to change is the number that is in bold, that is the skin id number. It is also important to note that there is a comma after each line apart from the last one.