j'ai fait un code pour faire un chois entre couleur et motif
Code : Tout sélectionner
<div class="form-group col-md-4">
<select id="configuration_backgroundType" class="form-control"><option value="0">Couleur</option><option value="1" selected="selected">Motif</option></select>
</div>
<div class="row motif">
<div class="col-md-3">
<input type="radio" id="background_image" name="background_image" value="0" />
<img src="./img/background-0.jpg" class="background-choice">
</div>
<div class="col-md-3">
<input type="radio" id="background_image" name="background_image" value="1" />
<img src="./img/background-1.jpg" class="background-choice">
</div>
<div class="col-md-3">
<input type="radio" id="background_image" name="background_image" value="2" />
<img src="./img/background-2.jpg" class="background-choice">
</div>
<div class="col-md-3">
<input type="radio" id="background_image" name="background_image" value="3" />
<img src="./img/background-3.jpg" class="background-choice">
</div>
</div>
Code : Tout sélectionner
setBackgroundColor: function () {
if (prayer.confData.backgroundType === 'couleur') {
$("body").css("backgroundColor", prayer.confData.backgroundColor);
}
if (prayer.confData.backgroundType === 'motif') {
$("body").css("backgroundImage", 'url("./img/background-' + prayer.confData.background_image)');
}
},