diff --git a/core/core.js.php b/core/core.js.php index adbdb993..30f9bbce 100755 --- a/core/core.js.php +++ b/core/core.js.php @@ -316,6 +316,7 @@ core.start = function() { core.noticeAdd(_this.attr("id"), "Format incorrect"); } }); + /** * Iframes et vidéos responsives */ @@ -338,7 +339,25 @@ core.start = function() { }); }).trigger("resize"); + /* + * Header responsive + */ + $(window).on("resize", function() { + var responsive = "getdata(['theme','header','imageContainer']);?>"; + if (responsive === "cover" || responsive === "contain" ) { + var widthpx = "getdata(['theme','site','width']);?>"; + var width = widthpx.substr(0,widthpx.length-2); + var heightpx = "getdata(['theme','header','height']);?>"; + var height = heightpx.substr(0,heightpx.length-2); + var ratio = width / height; + $("header").height( $(window).width() / ratio ); + $("header").css("line-height", $(window).width() / ratio + "px"); + } + }).trigger("resize"); + }; + + core.start(); /** diff --git a/core/core.php b/core/core.php index a747e134..ecd4f07e 100644 --- a/core/core.php +++ b/core/core.php @@ -1286,22 +1286,9 @@ class core extends common { $css .= 'header{background-size:' . $this->getData(['theme','header','imageContainer']).'}'; $css .= 'header{background-color:' . $colors['normal']; + // Valeur de hauteur traditionnelle + $css .= ';height:' . $this->getData(['theme', 'header', 'height']) . ';line-height:' . $this->getData(['theme', 'header', 'height']) ; - if ($this->getData(['theme', 'header', 'height']) === 'none') { - // Controle de l'existence du fichier - if (file_exists(self::FILE_DIR.'source/' . $this->getData(['theme','header','image'])) && - $this->getData(['theme', 'header', 'image']) ) { - // On établie la hauteur du div en proportion de l'image - // (hauteur / largeur) . 100 - $sizes = getimagesize(self::FILE_DIR.'source/'.$this->getData(['theme','header','image'])); - $css .= ';height: 0; padding-top:'; - $css .= ( $sizes[1] / $sizes[0] )* 100; - $css .= '%'; - } - } else { - // Valeur de hauteur traditionnelle - $css .= ';height:' . $this->getData(['theme', 'header', 'height']) . ';line-height:' . $this->getData(['theme', 'header', 'height']) ; - } $css .= ';text-align:' . $this->getData(['theme', 'header', 'textAlign']) . '}'; if($themeHeaderImage = $this->getData(['theme', 'header', 'image'])) { $css .= 'header{background-image:url("../file/source/' . $themeHeaderImage . '");background-position:' . $this->getData(['theme', 'header', 'imagePosition']) . ';background-repeat:' . $this->getData(['theme', 'header', 'imageRepeat']) . '}'; diff --git a/core/layout/main.php b/core/layout/main.php index cb1ae5ea..757f9455 100755 --- a/core/layout/main.php +++ b/core/layout/main.php @@ -57,19 +57,17 @@ getData(['theme','header','linkHomePage'])){ echo "" ;} ?> +
getData(['theme', 'header', 'textHide']) === false // Affiche toujours le titre de la bannière pour l'édition du thème OR ($this->getUrl(0) === 'theme' AND $this->getUrl(1) === 'header') ): ?> -
getData(['config', 'title']); ?> -
-
  -
+
> getData(['theme','header','linkHomePage'])){echo "
";} ?> @@ -129,19 +127,17 @@ if ($this->getData(['theme','header','linkHomePage'])){ echo "" ;} ?>
getData(['theme', 'header', 'position']) === 'hide'): ?>class="displayNone"> - getData(['theme', 'header', 'textHide']) === false - // Affiche toujours le titre de la bannière pour l'édition du thème - OR ($this->getUrl(0) === 'theme' AND $this->getUrl(1) === 'header') - ): ?> -
- getData(['config', 'title']); ?> -
- -
-   -
- +
+ getData(['theme', 'header', 'textHide']) === false + // Affiche toujours le titre de la bannière pour l'édition du thème + OR ($this->getUrl(0) === 'theme' AND $this->getUrl(1) === 'header') + ): ?> + getData(['config', 'title']); ?> + +   + +
getData(['theme','header','linkHomePage'])){echo "
";} ?> diff --git a/core/module/theme/theme.php b/core/module/theme/theme.php index 1b337c8f..d90d0db3 100755 --- a/core/module/theme/theme.php +++ b/core/module/theme/theme.php @@ -221,8 +221,8 @@ class theme extends common { ]; public static $headerWide = [ 'auto auto' => 'Automatique', - 'cover' => 'Responsive (cover)', '100% 100%' => 'Image étirée (100% 100%)', + 'cover' => 'Responsive (cover)', 'contain' => 'Responsive (contain)' ]; public static $footerTemplate = [ diff --git a/core/module/theme/view/header/header.js.php b/core/module/theme/view/header/header.js.php index b2973725..7f7ef845 100755 --- a/core/module/theme/view/header/header.js.php +++ b/core/module/theme/view/header/header.js.php @@ -12,7 +12,10 @@ * @link http://zwiicms.com/ */ - +$(document).ready(function(){ + $("header").css("line-height", ""); + $("header").css("height", ""); +}); /** * Aperçu en direct @@ -35,21 +38,25 @@ $("input, select").not("#barSelectLanguage").on("change", function() { tmpImgHeight = tmpImg.height; } - //Modifier la dropdown liste - if ($("#themeHeaderImage").val() !== "") { + //Modifier la dropdown liste si une image n'est pas sélectionnée + if ($("#themeHeaderImage").val() !== "" ) { // Une image est ajoutée ou changée - if ($("#themeHeaderHeight option").length === 4) { + if ($("#themeHeaderHeight option").length === 5) { + // Pas d'image précédemment on ajoute l'option $("#themeHeaderHeight ").prepend(''); - } + } // Modifier la valeur $("#themeHeaderHeight option:eq(0)").val(tmpImgHeight + "px"); // Modifier l'option - $("#themeHeaderHeight option:first-child").html("Hauteur de l\'image sélectionnée (" + tmpImgHeight + "px)"); - } else { - $("#themeHeaderHeight option:first-child").html("Hauteur de l\'image sélectionnée"); + $("#themeHeaderHeight option:eq(0)").html("Hauteur de l\'image sélectionnée (" + tmpImgHeight + "px)"); } }; + if ($("#themeHeaderImage").val() === "" && + $("#themeHeaderHeight option").length === 6 ) { + $("#themeHeaderHeight option:eq(0)").remove(); + } + tmpImg.src= "" + "site/file/source/" + $("#themeHeaderImage").val(); // Import des polices de caractères diff --git a/core/module/theme/view/header/header.php b/core/module/theme/view/header/header.php index 93138573..d65a2132 100755 --- a/core/module/theme/view/header/header.php +++ b/core/module/theme/view/header/header.php @@ -55,24 +55,18 @@
-
+
'Répétition', 'selected' => $this->getData(['theme', 'header', 'imageRepeat']) ]); ?>
-
+
'Position', 'selected' => $this->getData(['theme', 'header', 'imagePosition']) ]); ?>
-
- 'Adaptation', - 'selected' => $this->getData(['theme', 'header', 'imageContainer']) - ]); ?> -
@@ -98,20 +92,29 @@

Configuration

-
+
'Position', 'selected' => $this->getData(['theme', 'header', 'position']) ]); ?>
-
+
+ 'Adaptation', + 'selected' => $this->getData(['theme', 'header', 'imageContainer']), + 'help' => 'Les modes responsives permettent de conserver des dimensions proportionnelles.
+ Cover pour une image plus grande que la bannière, Contain pour une image plus petite. + Les modes Auto et Etiré ne provoquent pas de modification de la hauteur de la bannière.' + ]); ?> +
+
'Hauteur', + 'label' => 'Hauteur maximale', 'selected' => $this->getData(['theme', 'header', 'height']), - 'help' => "Quelque soit la taille de la bannière, la hauteur maximale autorisée est de 600 pixels." + 'help' => 'La hauteur maximale est de 600 pixels, même si les dimensions de l\'image sélectionnée sont supérieures.
Lorsque l\'adaptation est positionnée sur Responsive, la hauteur diminue proportionnellement à la largeur.' ]); ?>
-
+
'Alignement du contenu', 'selected' => $this->getData(['theme', 'header', 'textAlign'])