LoginSignup
0
0

More than 3 years have passed since last update.

bxsliderの画像が1つ飛ばしになるときに確認したいこと

Posted at

背景

オプション'fade'を使ったbxsliderの画像が1つ飛ばしになってしまい、順番が変わってしまう修正を依頼されました。

原因

index.html
<ul id="bxslider">
    <li></li>
    <li></li>
    <li></li>
    <li></li>
    <li></li>
    <li></li>
    <li></li>
    <li></li>
</ul>
script.js
$('#bxslider').bxSlider({
  auto: true,
  mode: 'fade',
  speed: 3000,
  pause: 2000,
  autoDelay: 1000
});

bxsliderのオプション

アニメーション移り変わるspeed > 画像を表示するpause
という数値になっているので、移り変わろうとしている間に次の画像に行こうとしているのが原因かと思います。

解決

script.js
$('#bxslider').bxSlider({
  auto: true,
  mode: 'fade',
  speed: 3000,
  autoDelay: 1000
});

こんな感じで、pause: 2000を消してしまうか、pause: 5000など大きい数値に変更すると解決し、順番は意図したとおりになりました。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0