Swiper滑块扩展在加载页面中不起作用,它只在我在浏览器中打开inspect元素时起作用。
我的代码是:
<?php
use yii\helpers\Html;
use romkaChev\yii2\swiper\Swiper;
?>
<article id="slider">
<?php
$item[] = ['<img src="/files/upload/slider/1.jpg" width="100%">',
'<img src="/files/upload/slider/2.jpg" width="100%">'
]
echo Swiper::widget([
'items' => $item,
'behaviours' => [
Swiper::BEHAVIOUR_NEXT_BUTTON,
Swiper::BEHAVIOUR_PREV_BUTTON,
],
'pluginOptions' => [
Swiper::OPTION_PAGINATION_CLICKABLE => true,
Swiper::OPTION_EFFECT => Swiper::OPTION_FADE,
Swiper::OPTION_LOOP => true,
Swiper::OPTION_AUTOPLAY => 3000,
Swiper::OPTION_SPEED => 1000,
]
]);
?>
</article>