Revert header.js

This commit is contained in:
fredtempez 2021-03-22 18:51:40 +01:00
parent b9d4971aa6
commit ffe8e7aa8a

View File

@ -12,7 +12,7 @@
* @link http://zwiicms.fr/ * @link http://zwiicms.fr/
*/ */
$(document).ready(function(){ $(document).ready(function(){
$("header").css("line-height", ""); $("header").css("line-height", "");
$("header").css("height", ""); $("header").css("height", "");
}); });
@ -104,17 +104,12 @@ $("input, select").on("change", function() {
css += 'header{margin:0}'; css += 'header{margin:0}';
} }
// Position de la bannière // Position de la bannière
var headerPosition = $("#themeHeaderPosition").val(); switch($("#themeHeaderPosition").val()) {
var menuPosition = <?php echo json_encode($this->getData(['theme', 'menu', 'position'])); ?>;
console.clear();
console.log ("menu :" + menuPosition);
console.log ("header :" + headerPosition);
switch(headerPosition) {
case 'hide': case 'hide':
$("header").hide(); $("header").hide();
break; break;
case 'site': case 'site':
if( menuPosition === 'site-first') { if(<?php echo json_encode($this->getData(['theme', 'menu', 'position']) === 'site-first'); ?>) {
$("header").show().insertAfter("nav"); $("header").show().insertAfter("nav");
} }
else { else {
@ -123,22 +118,16 @@ $("input, select").on("change", function() {
if(<?php echo json_encode($this->getData(['theme', 'menu', 'margin'])); ?>) { if(<?php echo json_encode($this->getData(['theme', 'menu', 'margin'])); ?>) {
css += 'nav{margin:0 20px}'; css += 'nav{margin:0 20px}';
} }
if (menuPosition === 'site-second') {
$("nav").show().prependTo("#site");
}
} }
break; break;
case 'body': case 'body':
if( menuPosition === 'body-first') { if(<?php echo json_encode($this->getData(['theme', 'menu', 'position']) === 'body-first'); ?>) {
$("header").show().insertAfter("nav"); $("header").show().insertAfter("nav");
} }
else { else {
$("header").show().insertAfter("#bar"); $("header").show().insertAfter("#bar");
} }
if ( menuPosition === "site-second") { if(<?php echo json_encode($this->getData(['theme', 'menu', 'position']) === 'top'); ?>) {
$("nav").show().insertBefore("header");
}
if( menuPosition === 'top') {
$("header").show().insertAfter("nav"); $("header").show().insertAfter("nav");
} }
break; break;