jquery - RoyalSlider change background from a div with each slide -


i use royalslider website , want change background color different color each slider.

the div want change #slide6 this:

$('#slide6').css({"background-color":"red"}); 

but don't know how it. here html structure

<div id="content-slider-1" class="royalslider contentslider rsdefault">     <div>      <h3>slide html text</h3>     <p>this dummy copy.</p>     <span class="rstmb">html text</span>     </div> 

maybe can use data-color='red'and if/else background color?

i can see data each slide with:

var slider = $('#content-slider-1').data('royalslider');     slider.ev.on('rsbeforeanimstart', function() {          console.log( $('#content-slider-1').data('royalslider').currslide );  }); 

can me out this? thank much!

you add class on div wrapping each slide, , control background color css

<div id="content-slider-1" class="royalslider contentslider rsdefault"> <div class="slide1">  <h3>slide html text</h3> <p>this dummy copy.</p> <span class="rstmb">html text</span> </div> <div class="slide2">  <h3>slide html text</h3> <p>this dummy copy.</p> <span class="rstmb">html text</span> </div>  .slide1 {background-color: red} .slide2 {background-color: blue} 

Comments

Popular posts from this blog

get url and add instance to a model with prefilled foreign key :django admin -

android - Keyboard hides my half of edit-text and button below it even in scroll view -

css - Make div keyboard-scrollable in jQuery Mobile? -