简体   繁体   中英

Loading css background images dynamically for slider

I have a slider implemented for latest movies coming in. The images are loaded from css background image property. Is there any way to call this background images dynamically into the slider only using css background property

You cant just Css background property. You need to call some jquery/javascript.

In Javascript you can for() like this;

 var array = ["#000000","#cc0000","#444444"];

 for ( var i=0; i<array.length; i++){
      $('.sampleDiv').css('background',''+array[i]+'');
 }

its just a idea,

And Maybe you can call array with javascript setInterval();

Check FIDDLE

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM