質問編集履歴
1
JSのコードを追加
test
CHANGED
File without changes
|
test
CHANGED
@@ -584,6 +584,70 @@
|
|
584
584
|
|
585
585
|
```
|
586
586
|
|
587
|
+
// よくある質問のアコーディオン
|
588
|
+
|
589
|
+
|
590
|
+
|
591
|
+
jQuery(function(){
|
592
|
+
|
593
|
+
var d = document,
|
594
|
+
|
595
|
+
accordionToggles = d.querySelectorAll('.js-accordionTrigger'),
|
596
|
+
|
597
|
+
setAria,
|
598
|
+
|
599
|
+
setAccordionAria,
|
600
|
+
|
601
|
+
switchAccordion,
|
602
|
+
|
603
|
+
touchSupported = ('ontouchstart' in window),
|
604
|
+
|
605
|
+
pointerSupported = ('pointerdown' in window);
|
606
|
+
|
607
|
+
skipClickDelay = function(e){
|
608
|
+
|
609
|
+
e.preventDefault();
|
610
|
+
|
611
|
+
e.target.click();
|
612
|
+
|
613
|
+
}
|
614
|
+
|
615
|
+
|
616
|
+
|
617
|
+
setAriaAttr = function(el, ariaType, newProperty){
|
618
|
+
|
619
|
+
el.setAttribute(ariaType, newProperty);
|
620
|
+
|
621
|
+
};
|
622
|
+
|
623
|
+
setAccordionAria = function(el1, el2, expanded){
|
624
|
+
|
625
|
+
switch(expanded) {
|
626
|
+
|
627
|
+
case "true":
|
628
|
+
|
629
|
+
setAriaAttr(el1, 'aria-expanded', 'true');
|
630
|
+
|
631
|
+
setAriaAttr(el2, 'aria-hidden', 'false');
|
632
|
+
|
633
|
+
break;
|
634
|
+
|
635
|
+
case "false":
|
636
|
+
|
637
|
+
setAriaAttr(el1, 'aria-expanded', 'false');
|
638
|
+
|
639
|
+
setAriaAttr(el2, 'aria-hidden', 'true');
|
640
|
+
|
641
|
+
break;
|
642
|
+
|
643
|
+
default:
|
644
|
+
|
645
|
+
break;
|
646
|
+
|
647
|
+
}
|
648
|
+
|
649
|
+
};
|
650
|
+
|
587
651
|
//function
|
588
652
|
|
589
653
|
switchAccordion = function(e) {
|