Warning: strpos() expects parameter 1 to be string, array given in /home/miyucolor/www/risalog/wordpress/wp-includes/blocks.php on line 50

Warning: strpos() expects parameter 1 to be string, array given in /home/miyucolor/www/risalog/wordpress/wp-includes/blocks.php on line 50

Warning: Cannot modify header information - headers already sent by (output started at /home/miyucolor/www/risalog/wordpress/wp-includes/blocks.php:50) in /home/miyucolor/www/risalog/wordpress/wp-content/plugins/all-in-one-seo-pack/app/Common/Meta/Robots.php on line 89

Warning: Cannot modify header information - headers already sent by (output started at /home/miyucolor/www/risalog/wordpress/wp-includes/blocks.php:50) in /home/miyucolor/www/risalog/wordpress/wp-includes/feed-rss2.php on line 8
HTML | risalog https://risalog.org Notes on web design, coding. Wed, 11 Nov 2020 02:35:20 +0000 ja hourly 1 https://wordpress.org/?v=5.7.12 Swiper.js スライダー コードまとめ https://risalog.org/swiper-js/?utm_source=rss&utm_medium=rss&utm_campaign=swiper-js https://risalog.org/swiper-js/#respond Tue, 01 Sep 2020 04:17:10 +0000 http://risalog.org/?p=209 Swiper.js https://swiperjs.com/api/ ページネーション、アローのクリック後にオートプレーが止まるとき。My swiper with Swiper.js stop autoplay aft […]

The post Swiper.js スライダー コードまとめ first appeared on risalog.]]>
Swiper.js

https://swiperjs.com/api/

<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/Swiper/3.4.1/css/swiper.min.css">
<script src="https://cdnjs.cloudflare.com/ajax/libs/Swiper/3.4.1/js/swiper.min.js"></script>
<!-- Slider main container -->
<div class="swiper-container">
  <!-- Additional required wrapper -->
  <div class="swiper-wrapper">
    <!-- Slides -->
    <div class="swiper-slide">Slide 1</div>
    <div class="swiper-slide">Slide 2</div>
    <div class="swiper-slide">Slide 3</div>
    ...
  </div>
  <!-- If we need pagination -->
  <div class="swiper-pagination"></div>
  <!-- If we need navigation buttons -->
  <div class="swiper-button-prev"></div>
  <div class="swiper-button-next"></div>
  <!-- If we need scrollbar -->
  <div class="swiper-scrollbar"></div>
</div>

<script>
  var mySwiper = new Swiper('.swiper-container', {
    loop: true,
    loopAdditionalSlides: 3,
    autoplayDisableOnInteraction: false,
    slidesPerView: 1.5,
    spaceBetween: 30,
    centeredSlides: true,
    speed: 1000,
    autoplay: 3000,
    observer: true,
    observeParents: true,
    preventClicks: true,
    preventClicksPropagation: true,
    paginationClickable: true,
    pagination: '.swiper-pagination',
    nextButton: '.swiper-button-next',
    prevButton: '.swiper-button-prev'
  })
</script>

ページネーション、アローのクリック後にオートプレーが止まるとき。
My swiper with Swiper.js stop autoplay after slide it with finger, why?
autoplaydisableOnInteraction: Set to false and autoplay will not be disabled after user interactions (swipes), it will be restarted every time after interaction.

autoplayDisableOnInteraction: false,

2ループ目以降の2個目のスライドが表示されないとき。
Slide disappear when using loop and centeredSlides
loopAdditionalSlides: Addition number of slides that will be cloned after creating of loop.

loopAdditionalSlides: 3,

レスポンシブで上手く表示されないとき。
Swiper slider not working unless page is resized
observer: Set to true to enable Mutation Observer on Swiper and its elements. In this case Swiper will be updated (reinitialized) each time if you change its style (like hide/show) or modify its child elements (like adding/removing slides).

observeParents: Set to true if you also need to watch Mutations for Swiper parent elements.

observer: true,
observeParents: true,

ページネーションのドットがクリックできないとき。
clickableClickable: If true then clicking on pagination button will cause transition to appropriate slide. Only for bullets pagination type.

paginationClickable: true,

スワイプ中にリンクがクリックされるのを防ぐ。
preventClicks: Set to true to prevent accidental unwanted clicks on links during swiping.

preventClicks: true,

preventClicksPropagation: Set to true to stop clicks event propagation on links during swiping.

preventClicksPropagation: true,
The post Swiper.js スライダー コードまとめ first appeared on risalog.]]>
https://risalog.org/swiper-js/feed/ 0