アプリケーションにウィザード (フォーム付き) を実装したいと考えています。したがって、jquery.steps (ここで見つけることができます) を使用したいと思います。
正しい js ファイルを含むアセットバンドルを作成しました
namespace app\assets;
use yii\web\AssetBundle;
class WizardAsset extends AssetBundle
{
public $basePath = '@webroot';
public $baseUrl = '@web';
public $css = [
'css/site.css',
'css/smart_wizard.css',
'css/jquery.steps.css',
];
public $js = [
'js/jquery.steps.min.js',
];
public $depends = [
'yii\web\YiiAsset',
'yii\bootstrap\BootstrapAsset',
];
}
そして、私の見解では次のコードを持っています:
<?php
use app\assets\WizardAsset;
WizardAsset::register($this);
?>
<div id="example-basic">
<h3>Keyboard</h3>
<section>
<p>Try the keyboard navigation by clicking arrow left or right!</p>
</section>
<h3>Effects</h3>
<section>
<p>Wonderful transition effects.</p>
</section>
<h3>Pager</h3>
<section>
<p>The next and previous buttons help you to navigate through your content.</p>
</section>
</div>
<script>
$("#example-basic").steps({
headerTag: "h3",
bodyTag: "section",
transitionEffect: "slideLeft",
autoFocus: true
});
</script>
ただし、これは機能していないようです。html ファイルの末尾にある .. の前に javascript ファイルをロードする必要があると思いますが、Yii はスクリプトをファイルの末尾に強制します。これを克服する方法はありますか?それとも私はこれが間違いだと正しいですか?