/ Published in: jQuery
Really simple jQuery random image
Expand |
Embed | Plain Text
$(document).ready(function(){ bgImageTotal=20; randomNumber = Math.round(Math.random()*(bgImageTotal-1))+1; imgPath=('/my/image/path/'+randomNumber+'.jpg'); $('h1').css('background-image', ('url("'+imgPath+'")')); });
You need to login to post a comment.
