Do you know how to load a random css without refreshing the page? I would like to load a random style like the one achieved in this thread:
<script>
var link = [];
link[0] = "css/0.css";
link[1] = "css/1.css";
link[2] = "css/2.css";
link[3] = "css/3.css";
$(function() {
var style = link[Math.floor(Math.random() * link.length )];
if (document.createStyleSheet){
document.createStyleSheet(style);
}else{
$('<link />',{
rel :'stylesheet',
type:'text/css',
href: style
}).appendTo('head');
}
});
</script>
This code works, but is it possible to load another style randomly every 5 seconds without refreshing? Thanks a lot.
Aucun commentaire:
Enregistrer un commentaire