Jump to content

Change order of content blocks on blog pages on mobile

Recommended Posts

Posted

Site URL: https://www.atuttatuscia.it/database/monti-cimini-e-lago-di-vico/caprarola/tusciavventure

Hi everyone,

I am looking to change the order of content blocks on all blogs pages on mobile. 
Here's an example: https://www.atuttatuscia.it/database/monti-cimini-e-lago-di-vico/caprarola/tusciavventure 
(pw: Access)

On mobile, I would like to have the main picture between the address "Lago di Vico, Località Spinaceto etc" and the description "Fantastico Parco Avventura all’interno della Riserva Naturale Regionale del Lago di Vico etc".

How can I achieve that? It needs to be a piece of code that applies to all my blog pages, not just this specific one.

Thank you!

  • Replies 7
  • Views 475
  • Created
  • Last Reply

Top Posters In This Topic

Posted

You can use this code to Website Tools > Code Injection > Footer. You can try it, if it works, I will give you a rule to apply to all blogs

<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.7.1/jquery.min.js"></script>
<script>
  jQuery(document).ready(function($) {
function run() {
    if ($(window).width() <= 767) {
$('div#block-b2c52e62e1dc785f1a5f').insertBefore('div#block-yui_3_17_2_1_1728397085511_50110');
} else {

}
}
    run();
    window.addEventListener('resize', run)
});
</script>

image.thumb.png.7459945bf4d09d9c807e4c7ffd2b74fd.png

Email me if you have need any help (free, of course.). Answer within 24 hours. 
Or send to forum message

Contact Customer Care - Learn CSS - Buy me a coffee (thank you!)

Posted

You try these steps, then use code

(1) First, edit Image > Add this text to ALT Image

mobileimg

(2) Next, use this new code

<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.7.1/jquery.min.js"></script>
<script>
  jQuery(document).ready(function($) {
function run() {
    if ($(window).width() <= 767) {
$('div.image-block [alt*="mobileimg"]').insertBefore('div.blog-item-content .sqs-layout .span-12>.html-block:first-child');
} else {

}
}
    run();
    window.addEventListener('resize', run)
});
</script>

 

Email me if you have need any help (free, of course.). Answer within 24 hours. 
Or send to forum message

Contact Customer Care - Learn CSS - Buy me a coffee (thank you!)

Posted

Hi @tuanphan, I have added the alt text to the relevant image on 2 separate blogs.

On this one https://www.atuttatuscia.it/database/monti-cimini-e-lago-di-vico/caprarola/tusciavventure it works, although the address (Lago di Vico, Località Spinaceto Fondo Cencio, 01032 Caprarola (VT) needs to come before the image, just after the title.

On this other one https://www.atuttatuscia.it/database/monti-cimini-e-lago-di-vico/ronciglione/hype-salon it doesn't work.

Posted
On 10/16/2024 at 7:22 PM, TheHouseOfMischief said:

Hi @tuanphan, I have added the alt text to the relevant image on 2 separate blogs.

On this one https://www.atuttatuscia.it/database/monti-cimini-e-lago-di-vico/caprarola/tusciavventure it works, although the address (Lago di Vico, Località Spinaceto Fondo Cencio, 01032 Caprarola (VT) needs to come before the image, just after the title.

On this other one https://www.atuttatuscia.it/database/monti-cimini-e-lago-di-vico/ronciglione/hype-salon it doesn't work.

I wrote a detail guide here

 

Email me if you have need any help (free, of course.). Answer within 24 hours. 
Or send to forum message

Contact Customer Care - Learn CSS - Buy me a coffee (thank you!)

  • 2 weeks later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

×
×
  • 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.