Jump to content

Same code doing different things on different pages

Recommended Posts

Posted

Hi folks,

I have code that allows me to create FAQ dropdowns on my site, however it does expand like the accordian on one page, but not the other, but I believe it's the exact same code!


I have this code on 2 different pages on my site

https://chromatical.com.au/faq

and 

https://chromatical.com.au/chromatical-club (it's a long page and it's nearer the bottom end - just search FAQ)

The code I'm using involves the code inside the markdown, and also code that gets hidden in the bottom of each page. 

The code works as required on the FAQ page - (The boxes open and close when clicked to reveal the answers to the questions)

However on the second page, the boxes do not expand and I can't figure out why as I didn't do anything different.

Hope someone can help!

  • Replies 17
  • Views 1k
  • Created
  • Last Reply
Posted

Try to replace the code in your footer with this

$(document).on("click", '.markdown-block h4', function() {
      $(this).toggleClass('open').children('*:not(h4)').slideToggle(); 
});

image.png.4714bd2c962e61b0281485f6787c388f.png

BeyondSpace - Squarespace Website Developer

🖼️ Lightbox Studio (Pinch/Zoom images, videos - PDFs Lightbox - ...) </>  🗓️ Delivery Date Picker (Date picker form field)
Gallery block 7.1 workaround </> 🤖 Ask me anything

Posted
5 minutes ago, bangank36 said:

Try to replace the code in your footer with this


$(document).on("click", '.markdown-block h4', function() {
      $(this).toggleClass('open').children('*:not(h4)').slideToggle(); 
});

image.png.4714bd2c962e61b0281485f6787c388f.png

Gday! Thanks heaps, I'll give it a go. Should I do this on both pages considering it's the same code? Just in case the other page breaks too?

 

Posted
1 minute ago, Trishyeah said:

Gday! Thanks heaps, I'll give it a go. Should I do this on both pages considering it's the same code? Just in case the other page breaks too?

 

Both page is good, let's update this markdown to use this from now on, but it still need you to add to see if it work

BeyondSpace - Squarespace Website Developer

🖼️ Lightbox Studio (Pinch/Zoom images, videos - PDFs Lightbox - ...) </>  🗓️ Delivery Date Picker (Date picker form field)
Gallery block 7.1 workaround </> 🤖 Ask me anything

Posted

Hmm no still not working on my end 😞 

This is my full code!

<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<script>
 $(document).ready(function () {
  $(document).on("click", '.markdown-block h4', function() {
      $(this).toggleClass('open').children('*:not(h4)').slideToggle(); 
});
    }); 
</script>
<style>
body:not(.sqs-edit-mode) .markdown-block h4 {
    display: block !important;
     cursor: pointer;
}
  body:not(.sqs-edit-mode) .markdown-block h4 + blockquote {
    display: none;
}
    body:not(.sqs-edit-mode) h4.open + blockquote {
    display: block;
}
  body:not(.sqs-edit-mode) .markdown-block blockquote {
    margin-left: 0;
    margin-right: 0;
}
  .markdown-block h4 {
    background: #fdeef3;
    padding: 10px;
    margin-top: 0 !important;
    margin-bottom: 0 !important;
    border-bottom: 1px solid #000000;
}
  .markdown-block h4 + blockquote {
    background: #fdeef3;
    margin-top: 0;
    padding: 20px;
}
</style>

Posted
3 hours ago, bangank36 said:

That's weird, you can invite me as collaborator to fix issue directly bangank36@gmail.com

4 hours ago, bangank36 said:

Try to replace the code in your footer with this



$(document).on("click", '.markdown-block h4', function() {
      $(this).toggleClass('open').children('*:not(h4)').slideToggle(); 
});

image.png.4714bd2c962e61b0281485f6787c388f.png

Gday! Thanks heaps, I'll give it a go. Should I do this on both pages considering it's the same code? Just in case the other page breaks too?

3 hours ago, bangank36 said:

That's weird, you can invite me as collaborator to fix issue directly bangank36@gmail.com

Heya I just added you as a contributor thank you SO SO SO much! 

We are talking in another issue as well which you might be able to look at while you're in there (if that's okay).

It's this issue - https://forum.squarespace.com/topic/173734-code-only-sometimes-displays-correctly/#comment-410135

 

Posted
1 hour ago, Trishyeah said:

Gday! Thanks heaps, I'll give it a go. Should I do this on both pages considering it's the same code? Just in case the other page breaks too?

Heya I just added you as a contributor thank you SO SO SO much! 

We are talking in another issue as well which you might be able to look at while you're in there (if that's okay).

It's this issue - https://forum.squarespace.com/topic/173734-code-only-sometimes-displays-correctly/#comment-410135

 

There is a duplication script on "HOW CAN YOU JOIN?" section, I removed and it worked

BeyondSpace - Squarespace Website Developer

🖼️ Lightbox Studio (Pinch/Zoom images, videos - PDFs Lightbox - ...) </>  🗓️ Delivery Date Picker (Date picker form field)
Gallery block 7.1 workaround </> 🤖 Ask me anything

Posted
1 hour ago, Trishyeah said:

Gday! Thanks heaps, I'll give it a go. Should I do this on both pages considering it's the same code? Just in case the other page breaks too?

Heya I just added you as a contributor thank you SO SO SO much! 

We are talking in another issue as well which you might be able to look at while you're in there (if that's okay).

It's this issue - https://forum.squarespace.com/topic/173734-code-only-sometimes-displays-correctly/#comment-410135

 

The second issue happen once or twice but I can't find the root cause I placed the stylesheet directly in section, hope that help

BeyondSpace - Squarespace Website Developer

🖼️ Lightbox Studio (Pinch/Zoom images, videos - PDFs Lightbox - ...) </>  🗓️ Delivery Date Picker (Date picker form field)
Gallery block 7.1 workaround </> 🤖 Ask me anything

Posted
11 hours ago, bangank36 said:

There is a duplication script on "HOW CAN YOU JOIN?" section, I removed and it worked

@bangank36Oh no, it's still not working for me on mobile or desktop :(:( The FAQ doesn't expand/close still but still works correctly on the other page. So strange!

Posted
11 hours ago, bangank36 said:

The second issue happen once or twice but I can't find the root cause I placed the stylesheet directly in section, hope that help

@bangank36 Also, (I commented above about the FAQ not working) But also, thank you SO much for your help with the weird section! I mentioned there were two pages with this issue, this is the other one https://chromatical.com.au/chromatical-club (right down the bottom) is there any chance you could put the stylesheet there as well? Thank you SO very much for your time I'm mighty grateful.

Posted
1 hour ago, Trishyeah said:

@bangank36Oh no, it's still not working for me on mobile or desktop :(:( The FAQ doesn't expand/close still but still works correctly on the other page. So strange!

IT's been working here, I just record a video

chrome-capture (2).gif

BeyondSpace - Squarespace Website Developer

🖼️ Lightbox Studio (Pinch/Zoom images, videos - PDFs Lightbox - ...) </>  🗓️ Delivery Date Picker (Date picker form field)
Gallery block 7.1 workaround </> 🤖 Ask me anything

Posted
11 minutes ago, bangank36 said:

IT's been working here, I just record a video

chrome-capture (2).gif

Hmm! Are you able to check on mobile? It is now working for me on desktop, but not on Chrome or Safari on iphone

Posted
3 minutes ago, bangank36 said:

Try ti clear browser cache

 

Screenshot_20201113-073342_Samsung Internet.png

OH YAY ITS WORKING THANK YOU SO MUCH AGAIN!!!!
Last question... did you get my message about the weird disappearing boxes that you added code for one one page? Hoping you could add it to the other page? 
Thank you again.

Posted
2 minutes ago, Trishyeah said:

place it there, if issue persist, you can post another topic some other designer may help

image.thumb.png.ba114982aaeaef82350c4248191b16bd.png

BeyondSpace - Squarespace Website Developer

🖼️ Lightbox Studio (Pinch/Zoom images, videos - PDFs Lightbox - ...) </>  🗓️ Delivery Date Picker (Date picker form field)
Gallery block 7.1 workaround </> 🤖 Ask me anything

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Squarespace Webinars

Free online sessions where you’ll learn the basics and refine your Squarespace skills.

Hire a Designer

Stand out online with the help of an experienced designer or developer.