jQuery Mobile: faire un élément pliable 100% largeur / NON incrustée
-
27-10-2019 - |
Question
Y at-il un moyen de faire un élément pliable / ensemble dans jQuery Mobile non encadré? Par défaut, il est l'élément pliable comme un élément encart.
data-inset="false"
ne modifie pas le comportement.
La solution
If you give the margin-left
and margin-right
properties a negative value you can expand the collapsible content to the width of the page.
The default margin-top
and margin-bottom
values for a collapsible are 8px
so we can write a CSS rule for this:
.ui-collapsible {
margin : 8px -15px;
}
I chose -15px
because that is the negative amount of padding
that the data-role="content"
element adds to each page.
Here is a jsfiddle to view what this does: http://jsfiddle.net/jasper/zSvqU/
Autres conseils
You could always put the collapsible content block in data-role="header"
, but of course this is only okay if your collapsible content doesn't need to be somewhere in the middle of your page.