Skip to content

Commit c03e250

Browse files
sbejaouidavid-s73
authored andcommitted
[IMP] - use display for element visibility
the visibility attribute with the hidden option hides the element but don't free the space. A common use case is to have a specific header for the first page and another for the other pages. With visibility: hidden the second header cannot take the first one place and will keep a huge margin. One solution is to use the display:none instead.
1 parent e8df660 commit c03e250

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

report_qweb_element_page_visibility/views/layouts.xml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,16 +33,16 @@
3333

3434
var operations = {
3535
'not-first-page': function (elt) {
36-
elt.style.visibility = (vars.sitepage == vars.frompage) ? "hidden" : "visible";
36+
elt.style.display = (vars.sitepage === vars.frompage) ? "none" : "inherit";
3737
},
3838
'not-last-page': function (elt) {
39-
elt.style.visibility = (vars.sitepage == vars.sitepages) ? "hidden" : "visible";
39+
elt.style.display = (vars.sitepage === vars.sitepages) ? "none" : "inherit";
4040
},
4141
'first-page': function (elt) {
42-
elt.style.visibility = (vars.sitepage == vars.frompage) ? "visible" : "hidden";
42+
elt.style.display = (vars.sitepage === vars.frompage) ? "inherit" : "none";
4343
},
4444
'last-page': function (elt) {
45-
elt.style.visibility = (vars.sitepage == vars.sitepages) ? "visible" : "hidden";
45+
elt.style.display = (vars.sitepage === vars.sitepages) ? "inherit" : "none";
4646
},
4747
'single-page': function (elt) {
4848
elt.style.display = (vars.sitepages === 1) ? "inherit" : "none";

0 commit comments

Comments
 (0)