Advertisement

Can't get bootstrap collapse paragraph to work

General questions relating to Joomla! 4.x.

Moderator: General Support Moderators

Forum rules
Forum Rules
Absolute Beginner's Guide to Joomla! <-- please read before posting.
Forum Post Assistant - If you are serious about wanting help, you should use this tool to help you post.
Windows Defender SmartScreen Issues <-- please read this if using Windows 10
Locked
stiandroid
Joomla! Apprentice
Joomla! Apprentice
Posts: 30
Joined: Sun Oct 23, 2022 6:12 pm

Can't get bootstrap collapse paragraph to work

Post by stiandroid » Sun Mar 19, 2023 4:40 pm

What do I have to do to have collapsing text in my articles?

Bootstrap docs: https://getbootstrap.com/docs/4.0/components/collapse/

I made a test article where I just copied the example code from the bootstrap documentation.

Do I have to add a reference to some javascript library in addition? I am just assuming that everything is included "out of the box" here, as I understand Joomla! 4 is using bootstrap 5 by default.

My test article:
https://gmgjeldsformidling.no/test-article

Advertisement
User avatar
AMurray
Joomla! Master
Joomla! Master
Posts: 10710
Joined: Sat Feb 13, 2010 7:35 am
Location: Australia

Re: Can't get bootstrap collapse paragraph to work

Post by AMurray » Sun Mar 19, 2023 10:12 pm

Joomla 4 uses Bootstrap 5. Your example code uses Bootstrap 4 (yet you acknowledge Joomla uses Bootstrap 5....)

If you want to use Boostrap 4, then I would guess you'd need to load the JS and CSs references from bootstrap CDN as documented here: https://getbootstrap.com/docs/4.0/getti ... roduction/ (add those to your template's index.php file). You might do this as an override so that your change is not overwritten by a template update. Use a child template of whatever template your site uses (your example looks like Cassiopeia).

However, given Joomla 4 uses Boostrap 5, why not use the Boostrap 5 collapse-paragraph:
https://www.w3schools.com/bootstrap5/bo ... llapse.php
Regards - A Murray
Global Support Moderator

User avatar
Pavel-ww
Joomla! Ace
Joomla! Ace
Posts: 1872
Joined: Tue Jun 30, 2020 12:17 pm

Re: Can't get bootstrap collapse paragraph to work

Post by Pavel-ww » Mon Mar 20, 2023 8:15 am

Hi @stiandroid.
Yes @AMurray is right. You should use bootstrap 5 components.

But that's not all. By default, Bootstrap 5 components are not connected to Cassiopea. You need to call them using the override of the article or module php file.
https://docs.joomla.org/J4.x:Using_Boot ... n_Joomla_4.

Here is example how it looks in article override
111.jpg
2.jpg
Or you can use another template where all the Bootstrap 5 JS bundle is connected from the box. For example Helix Ultimate
You do not have the required permissions to view the files attached to this post.

stiandroid
Joomla! Apprentice
Joomla! Apprentice
Posts: 30
Joined: Sun Oct 23, 2022 6:12 pm

Re: Can't get bootstrap collapse paragraph to work

Post by stiandroid » Fri Mar 24, 2023 12:37 pm

Thanks! The client ultimately decided against using collapsible paragraphs, but now I know how to do it! :)

Advertisement

Locked

Return to “General Questions/New to Joomla! 4.x”