site theme option bug margin

This commit is contained in:
Fred Tempez 2021-11-09 13:29:53 +01:00
parent 9d785957cb
commit fea3ff4075

View File

@ -11,35 +11,23 @@
* @link http://zwiicms.fr/ * @link http://zwiicms.fr/
*/ */
/*
* Chargement de l'aperçu
*/
$(document).ready(function() {
/**
* Option de marge si la taille n'est pas fluide
*/
if ($('#themeSiteWidth').val() === '100%') {
$("#themeSiteMargin").prop("checked", true);
$("#themeSiteMargin").addClass("disabled");
} else {
$("#themeSiteMargin").addClass("enabled");
}
// Charger l'aperçu initial
previewDOM();
});
/** /**
* Aperçu en direct * Aperçu en direct
*/ */
$("input, select").on("change",function() { $("input, select").on("change",function() {
previewDOM();
});
function previewDOM() { /**
* Option de marge si la taille n'est pas fluide
*/
if ($('#themeSiteWidth').val() === '100%') {
console.log ("pop");
$("#themeSiteMarginWrapper").prop("checked", true);
$("#themeSiteMarginWrapper").hide();
} else {
$("#themeSiteMarginWrapper").show();
}
/** /**
* Aperçu dans la boîte * Aperçu dans la boîte
@ -96,7 +84,6 @@ function previewDOM() {
// Couleur ou image de fond // Couleur ou image de fond
var backgroundImage = <?php echo json_encode(helper::baseUrl(false) . self::FILE_DIR . 'source/' . $this->getData(['theme','body','image'])); ?>; var backgroundImage = <?php echo json_encode(helper::baseUrl(false) . self::FILE_DIR . 'source/' . $this->getData(['theme','body','image'])); ?>;
console.log(backgroundImage);
var backgroundcolor = <?php echo json_encode($this->getdata(['theme','body','backgroundColor'])); ?>; var backgroundcolor = <?php echo json_encode($this->getdata(['theme','body','backgroundColor'])); ?>;
if(backgroundImage) { if(backgroundImage) {
css += "div.bodybackground{background-image:url(" + backgroundImage + ");background-repeat:" + $("#themeBodyImageRepeat").val() + ";background-position:" + $("#themeBodyImagePosition").val() + ";background-attachment:" + $("#themeBodyImageAttachment").val() + ";background-size:" + $("#themeBodyImageSize").val() + "}"; css += "div.bodybackground{background-image:url(" + backgroundImage + ");background-repeat:" + $("#themeBodyImageRepeat").val() + ";background-position:" + $("#themeBodyImagePosition").val() + ";background-attachment:" + $("#themeBodyImageAttachment").val() + ";background-size:" + $("#themeBodyImageSize").val() + "}";
@ -125,4 +112,4 @@ function previewDOM() {
.text(css) .text(css)
.appendTo("head"); .appendTo("head");
}; }).trigger("change");