Accordion 위젯 ( http://devdocs.magento.com/guides/v2.0/javascript-dev-guide/widgets/widget_accordion.html ) 으로 FAQ 페이지를 만들고 싶습니다 .
CMS 페이지에서 사용할 수 있습니까?
Accordion 위젯 ( http://devdocs.magento.com/guides/v2.0/javascript-dev-guide/widgets/widget_accordion.html ) 으로 FAQ 페이지를 만들고 싶습니다 .
CMS 페이지에서 사용할 수 있습니까?
답변:
것이 가능하다. 사용하고 싶다면
data-mage-init
그런 다음 다음과 같이하십시오.
<div id="element" data-mage-init='{"accordion":{"openedState": "active", "collapsible": true, "active": false, "multipleCollapsible": true}}'>
<div data-role="collapsible">
<div data-role="trigger">
<span>Title 1</span>
</div>
</div>
<div data-role="content">Content 1</div>
<div data-role="collapsible">
<div data-role="trigger">
<span>Title 2</span>
</div>
</div>
<div data-role="content">Content 2</div>
<div data-role="collapsible">
<div data-role="trigger">
<span>Title 3</span>
</div>
</div>
<div data-role="content">Content 3</div>
</div>
이것은 나를 위해 작동합니다 :
<div data-mage-init='{"accordion":{"openedState": "active", "collapsible": true, "active": false, "multipleCollapsible": false}}'>
<div data-role="collapsible">
<div data-role="trigger">
Title 1
</div>
</div>
<div data-role="content">
<p>
Content 1 bla bla bla.
</p>
</div>
<div data-role="collapsible">
<div data-role="trigger">
Title 2
</div>
</div>
<div data-role="content">
<p>
Content 2 bla bla bla.
</p>
</div>
</div>
<div id="element" data-mage-init='{"accordion":{"openedState": "active", "collapsible": true, "active": false, "multipleCollapsible": true}}'>
<button class="accordion" data-role="collapsible">Section 1</button>
<div class="panel" data-role="content">
<p>Lorem ipsum...</p>
</div>
<button class="accordion" data-role="collapsible">Section 2</button>
<div class="panel" data-role="content">
<p>Lorem ipsum...</p>
</div>
<button class="accordion" data-role="collapsible">Section 3</button>
<div class="panel" data-role="content">
<p>Lorem ipsum...</p>
</div>
.accordion {
background-color: #eee;
color: #444;
cursor: pointer;
padding: 18px;
width: 100%;
text-align: left;
border: none;
outline: none;
transition: 0.4s;
}
.active, .accordion:hover {
background-color: #ccc;
}
.panel {
padding: 0 18px;
background-color: white;
display: none;
overflow: hidden;
}