最近搜索


没有最近搜索

Jason McDonald's Avatar

Jason McDonald

已加入2023年2月24日

·

最后活动2023年2月27日

关注

0

关注者

0

活动总数

6

投票

0

订阅

1

活动概览

的最新活动 Jason McDonald

Jason McDonald 进行了评论,

社区评论 Discussion - Tips and best practices from the community

查看评论 · 已于 2023年2月27日 发布 · Jason McDonald

0

关注者

0

投票

0

评论


Jason McDonald 进行了评论,

社区评论 Discussion - Tips and best practices from the community

Hi Ifra.

This is exactly what I have done and the accordion won't expand when clicked.

查看评论 · 已于 2023年2月27日 发布 · Jason McDonald

0

关注者

0

投票

0

评论


Jason McDonald 进行了评论,

社区评论 Discussion - Tips and best practices from the community

The only code I have added to the script.js file is 

document.addEventListener('DOMContentLoaded', function() {
var acc = document.getElementsByClassName("accordion");
var i;

for (i = 0; i < acc.length; i++) {
acc[i].addEventListener("click", function() {
this.classList.toggle("active");
var panel = this.nextElementSibling;
if (panel.style.maxHeight) {
panel.style.maxHeight = null;
} else {
panel.style.maxHeight = panel.scrollHeight + "px";
}
});
}
});

We have multiple HC's for different brands and there's different content writers so I'm not sure what modifications have been made to this particular theme. As I said the accordion is working in other HC's we have. 

Is there anyway to find out which part of the theme code is affecting this? 

查看评论 · 已于 2023年2月24日 编辑 · Jason McDonald

0

关注者

0

投票

0

评论


Jason McDonald 进行了评论,

社区评论 Discussion - Tips and best practices from the community

script.js:473 Uncaught SyntaxError: Unexpected token 'export'

查看评论 · 已于 2023年2月24日 发布 · Jason McDonald

0

关注者

0

投票

0

评论


Jason McDonald 进行了评论,

社区评论 Discussion - Tips and best practices from the community

Hello. 

I've added the code Trapta provided at the beginning of the thread and this works perfectly in our sandbox HC.
When I tried doing it on our live environment it's not working. The accordion is here but clicking on it does not expand it. 

查看评论 · 已于 2023年2月24日 发布 · Jason McDonald

0

关注者

0

投票

0

评论