据说手风琴很棒:https://github.com/oncode/handorgel
任何方式我都无法使其发挥作用......
<link rel="stylesheet" href="https://unpkg.com/handorgel@0.4.2/lib/css/handorgel.css">
<script src="https://unpkg.com/handorgel@0.4.2/lib/js/umd/handorgel.js"></script>
和示例中的标记:
<div style="color: black" class="handorgel">
<h3 class="handorgel__header">
<button class="handorgel__header__button">
Title
</button>
</h3>
<div class="handorgel__content" data-open>
<div class="handorgel__content__inner">
Content openened by default
</div>
</div>
<h3 class="handorgel__header">
<button class="handorgel__header__button">
Title 2
</button>
</h3>
<div class="handorgel__content">
<div class="handorgel__content__inner">
Content closed by default
</div>
</div>
...
</div>
var accordion = new handorgel(document.querySelector('.handorgel'), {
// whether multiple folds can be opened at once
multiSelectable: true,
// whether the folds are collapsible
collapsible: true,
// header/content class if fold is open
headerOpenClass: 'handorgel__header--open',
contentOpenClass: 'handorgel__content--open',
// header/content class if fold has been opened (transition finished)
headerOpenedClass: 'handorgel__header--opened',
contentOpenedClass: 'handorgel__content--opened',
// header/content class if fold has been focused
headerFocusClass: 'handorgel__header--focus',
contentFocusClass: 'handorgel__content--focus',
// header/content class if fold is disabled
headerDisabledClass: 'handorgel__header--disabled',
contentDisabledClass: 'handorgel__content--disabled',
// header/content class if no transition should be active (applied on resize)
headerNoTransitionClass: 'handorgel__header--notransition',
contentNoTransitionClass: 'handorgel__content--notransition'
})
未捕获的ReferenceError:在js.js中未定义handorgel:1 - 我获得的错误。 我做错了什么?
答案 0 :(得分:0)
尝试在handorgel.js之前附加您自己的.js
,否则它将无效:)