Answer the question
In order to leave comments, you need to log in
How to include collapse.js?
It is required to make an accordion, for example, like here . But I can't figure out how best to include the collapse.js file, which is located in the vendor\bower\bootstrap\js folder.
I know about yii\bootstrap\Collapse, but I don't want to use a widget.
Answer the question
In order to leave comments, you need to log in
Create your resource set , include the collapse.js file in it, and register it in the required place.
For example:
class CollapseAsset extends AssetBundle
{
public $sourcePath = '@bower/bootstrap/js';
public $js= [
'collapse.js',
];
.....
}
CollapseAsset::register($this); // $this - объект представления
I don't understand what the problem is. After all, your example uses bootstrap.min.js and jquery.min.js . Connect and no problem.
There is also a strange option, but if you don’t want to bother with AssetBundle:
just add a widget to the view, without parameters, it will not render anything, but will connect its assets
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question