Is there any way to wrap multiple blocs into a div?

Hey all! :raised_hands:

To finally conquer a dynamic page loader I need to wrap all blocs into a single div.
Actually I need to wrap that div into another div and wrap it into one more div once again but I will figure that out. :woozy_face:

Is there any way to do that inside blocs?


Maybe by using a code widget by adding <div class="container " id="main-content">) on top of the first bloc and adding a second code widget with </div> on the bottom of the last one?

If it was possible it would be really easy to exactly mark which part of the content should be loaded using dynamicloader script. Currently its limited to a single bloc because there is no way to add a uniform ID to multiple blocs but wrapping them into a single div would allow me to do so.

And even to create a new free shiny bric in the future! :exploding_head:

If I place code widget within a bloc divs work as intended (it wraps everything inbetween <div>(code widget 1) and </div> (code widget 2):


but it doesn’t work for different blocs:


Is there any roundabout?

Just curious, what is the benefit of being able to wrap multiple blocs in one div?

Hi, KBConcepts!
I need to add a uniform ID to those blocs. If there is another way Ill take it!

There can be numerous advantages and reasons for such a setup. For instance many JS libraries require it for proper implementation. I discussed that aspect with Norm privately long ago but I’m unaware if it will be part of Blocs 4.

2 Likes

Ive found a solution:

you need to add this code to .js file and attach it to your current page:

$('#bloc-1, #bloc-2').wrapAll('<div ID="IDnewcontainer" />');

*correction there was an error in the code now its fine (code was adding class not an ID)

#bloc-1 etc. are IDs of blocs you need to wrap into IDnewcontainer (you can change the ID however you like) div

3 Likes

the only thing left is to make script work before the content from each page is loaded into a dynamic page :unamused:

you can also wrap this code into <script></script> tags and add it to a footer if you prefer

@EffexorXR, It’s been revealed that Blocs 4.2 will add the ability to wrap a bric in a div container. So maybe doing the same for multiple Blocs is somewhere on the distant horizon also.

https://twitter.com/i/status/1371774108686557187

wrap