I asked a question about slow loading images, but no response. I think I figured the issue is my accordion script. It seems that when it is active, SQ loads the Markdown Accordion box before the image at the top of my page. This makes it look like the page is very slow. However, if I add 'defer async' to the Custom Code JavaScript, the Accordion function doesn't load at all!
Question
MatthewCraig
Site URL: https://www.mh316.org/bible-studies/the-god-of-new-beginnings
Pass: myrtlefield
I asked a question about slow loading images, but no response. I think I figured the issue is my accordion script. It seems that when it is active, SQ loads the Markdown Accordion box before the image at the top of my page. This makes it look like the page is very slow. However, if I add 'defer async' to the Custom Code JavaScript, the Accordion function doesn't load at all!
Working code with slow image load:
<script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
<script>
$(document).ready(function(){
$('.markdown-block .sqs-block-content h1').addClass('ui-closed').css('cursor','pointer');
$(".markdown-block .sqs-block-content h1").nextUntil("h1").slideToggle();
$(".markdown-block .sqs-block-content h1").click(function() {
$(this).nextUntil("h1").slideToggle();
$(this).toggleClass('ui-closed ui-open');
});
});
Not working code with fast image load:
<script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js" defer async></script>
<script>
$(document).ready(function(){
$('.markdown-block .sqs-block-content h1').addClass('ui-closed').css('cursor','pointer');
$(".markdown-block .sqs-block-content h1").nextUntil("h1").slideToggle();
$(".markdown-block .sqs-block-content h1").click(function() {
$(this).nextUntil("h1").slideToggle();
$(this).toggleClass('ui-closed ui-open');
});
});
Link to comment
Top Posters For This Question
1
1
2
Popular Days
Apr 29
3
Feb 11
1
Top Posters For This Question
bangank36 1 post
Amaya_SQSP 1 post
MatthewCraig 2 posts
Popular Days
Apr 29 2021
3 posts
Feb 11 2022
1 post
Popular Posts
MatthewCraig
Site URL: https://www.mh316.org/bible-studies/the-god-of-new-beginnings Pass: myrtlefield I asked a question about slow loading images, but no response. I think I figured the issue is my accord
3 answers to this question
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment