css - How do I create a fade in effect on a rotating background image using Jquery -


I am currently using a small jquery script to rotate through background images on a portfolio site. The portfolio site here is the code:

  counter = 1; Num_images = 9; Dir = "Image Director URL"; Function Rotate Header () {var background_img = 'url (' + dir + '/ image' + Counter + '. Gif)'; JQuery ('Category'). CSS ('background image', background_EMG); Counter ++; If (counter> number_image) counter = 1; } SetInterval ("rotateHeader ()", 5000);  

You can see it working here:

What do I want to do in the picture and or the color fades and exits me It seems that I have to preload the images in order to do this and then add some type of fade property when the images are loaded. How do I do this?

Something like this should

  Vir counter = 1, number_inces = 9, diamond = "image indicator URL"; Function Rotate Header () {var background_img = 'url (' + dir + '/ image' + Counter + '. Gif)'; JQuery ('Category'). Feedout (function () {jQuery (this). CSS ('background-image', background_image). Fadein ();}); Counter ++; If (counter> number_image) counter = 1; } SetInterval (Rotate Header, 5000); First of all, we have started erasing the image of the current background, then in the callback function, change the background image and then fade it back. You may want to play with  fadeOut ()  and  Fadein ()  to get the effect you want to effect I want to evaluate a string in the name of the function name To change, also changed the  setInterval () . 


Comments

Popular posts from this blog

oracle - The fastest way to check if some records in a database table? -

php - multilevel menu with multilevel array -

jQuery UI: Datepicker month format -