1

How can i remove the flash effect appeared when refreshing the Background-Images ? The Background Image will be loaded and changed every second from server...

$('div').css('background-image',"url/img/backgrounds/"+bgImage);
  • 2
    You need to load the image before assigning it as the background, otherwise the image loads afterwards, causing the flash. – James Donnelly May 09 '14 at 10:41
  • You can make a sprite for your background, with all images, and then change the background-position property. Or as James say, you need to preload all of your image (wait for +bgImage and then apply that css) http://stackoverflow.com/questions/10863658/load-image-with-jquery-and-append-it-to-the-dom – keypaul May 09 '14 at 10:53
  • That works thank you James ! load the images and than assign the background was the best solution! – user3611446 May 09 '14 at 12:55

0 Answers0