CMS Development

CandiceLloyd
Participant

FAQ module won't open

Résolue

On many webapges we make use of the FAQ modules.

Previously they expanded no problem, suddenly it has broken across every page that makes use of this module and I am not sure how to fix it.

 

I do not have much knowledge of JavaScript so would need some assistance please in regards to fixing it and where to add it!

 

This is the current code I have for the FAQ module:

 

<div class="accordion">
<div class="accordion_group {% if widget.expanded %}expanded{% endif %}">
<div class="accordion_header"><span class="accordion_icon"><i class="far fa-plus-square"></i></span> {{ widget.faq_question }}</div>
<div class="accordion_content">
{{ widget.faq_answer }}
</div>
</div>
</div>

0 Votes
1 Solution acceptée
stefen
Solution
Conseiller clé | Partenaire solutions
Conseiller clé | Partenaire solutions

FAQ module won't open

Résolue

@CandiceLloyd you're probably missing the javascript. Add this and it should start working:

$('.accordion_header').on('click', function() {
  $(this).parent().toggleClass('expanded');
});

If it still doesn't work, check the console for any other JS errors.

Stefen Phelps, Community Champion, Kelp Web Developer

Voir la solution dans l'envoi d'origine

0 Votes
12 Réponses
jessebeginbound
Participant | Partenaire solutions Platinum
Participant | Partenaire solutions Platinum

FAQ module won't open

Résolue

Hi everyone! 

If you're still struggling with this issue, as we have in the past, we made a simple, feature-rich HubSpot Module for FAQ's that should work great for any HubSpot CMS page or website if you get fed up with the code.

 

Check it out here if you're interested: https://marketplace.hubspot.com/products/begin-bound/beginbound-ultimate-faq-module-live

 

Happy HubSpotting!

 

0 Votes
stefen
Solution
Conseiller clé | Partenaire solutions
Conseiller clé | Partenaire solutions

FAQ module won't open

Résolue

@CandiceLloyd you're probably missing the javascript. Add this and it should start working:

$('.accordion_header').on('click', function() {
  $(this).parent().toggleClass('expanded');
});

If it still doesn't work, check the console for any other JS errors.

Stefen Phelps, Community Champion, Kelp Web Developer
0 Votes
Ibis
Membre

FAQ module won't open

Résolue

I have the same issue.

Where do i paste that code and how?

thanks in advance!

0 Votes
stefen
Conseiller clé | Partenaire solutions
Conseiller clé | Partenaire solutions

FAQ module won't open

Résolue

@Ibis you could add it directly below the HTML inside of a script tag.:

<script>
... script goes here ...
</script>
Stefen Phelps, Community Champion, Kelp Web Developer
0 Votes
Ibis
Membre

FAQ module won't open

Résolue

Hi stefen,

 

thanks for your fast response. Do you mean like this?

 

<div class="accordion">
<div class="accordion_group {% if widget.expanded %}expanded{% endif %}">
<div class="accordion_header"><span class="accordion_icon"><i class="far fa-plus-square"></i></span> {{ widget.faq_question }}</div>
<div class="accordion_content">
{{ widget.faq_answer }}
</div>
</div>
</div>
<script> $('.accordion_header').on('click', function() {
$(this).parent().toggleClass('expanded');
}); </script>

 

Because it did not work. I really do not know a lot about it unfortunately.

 

best 

Giorgio

 

 

0 Votes
CandiceLloyd
Participant

FAQ module won't open

Résolue

 Hey Giorgio

 

I am attaching a screenshot of my code where I have gone in to the pages' template.

On the right side panel to the Additional <head> markup.

 

You will see the code I used starting beneath: <script type="text/javascript">

 

Screenshot 2019-08-29 at 16.27.39.png

0 Votes
stefen
Conseiller clé | Partenaire solutions
Conseiller clé | Partenaire solutions

FAQ module won't open

Résolue

@Ibis if that didn't work you might have other javascript errors on the page causing this script not to run because what you posted should work. Do you have a preview link to share?

Stefen Phelps, Community Champion, Kelp Web Developer
0 Votes
Ibis
Membre

FAQ module won't open

Résolue
0 Votes
stefen
Conseiller clé | Partenaire solutions
Conseiller clé | Partenaire solutions

FAQ module won't open

Résolue

@Ibis yes, that first one. It looks like you mixed up the javascript with the HTML. Are you not using the FAQ module?

Stefen Phelps, Community Champion, Kelp Web Developer
0 Votes
Ibis
Membre

FAQ module won't open

Résolue

hi stefen, apologies for the late respone. I had a flight to catch for vacation!

 

I did use the FAQ module but it shows as a flat template 😞

 

 

0 Votes
stefen
Conseiller clé | Partenaire solutions
Conseiller clé | Partenaire solutions

FAQ module won't open

Résolue

You should remove the HTML from the script tag. This HTML should be in the body where you want the tabs to appear on the page..You should remove the HTML from the script tag. This HTML should be in the body where you want the tabs to appear on the page..

Stefen Phelps, Community Champion, Kelp Web Developer
0 Votes
CandiceLloyd
Participant

FAQ module won't open

Résolue

Hey Stefan,

 

Thank you very much for your input! 

This worked well!

 

Kind regards,

Candice

0 Votes