php - how to set up rotating images? -



php - how to set up rotating images? -

so i've been looking around way rotate background image, every 7 or 8 seconds. problem seems me unclear how go using javascript of php code. set under tag or go in body? or upload server? sorry if seems basic question, begginer.

also best code use? in opinion.

upload images in folder on server each image number file number

/images/bg/...

then utilize next function alter background of body

var currentimageindex = 0; var maximageindex = 10; settimeout(function() { currentimageindex = currentimageindex + 1; if(currentimageindex > maximageindex) currentimageindex = 0; $(body).css("background-image", "/images/bg/" + currentimageindex + ".jpg"); }, 7000);

remember utilize 0's image background image default (in css)

php javascript jquery html css

Comments

Popular posts from this blog

iphone - Dismissing a UIAlertView -

c# - Can ProtoBuf-Net deserialize to a flat class? -

javascript - Change element in each JQuery tab to dynamically generated colors -