Advertisement
root777

JS/Swiper - Why did carousel objects all display, and rotate

Aug 29th, 2018
306
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 2.27 KB | None | 0 0
  1. {% extends "base.html" %}
  2. {% load i18n %}
  3. <head>
  4.   <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/Swiper/4.2.6/css/swiper.min.css">
  5. </head>
  6. {% block content %}
  7. <body>
  8.   <div class="home">
  9.     <div class="swiper-container">
  10.       <div class="swiper-wrapper">
  11.         {% for page_block in blocks_carousel %}
  12.               <div class="swiper-slide home--square--container">
  13.                 <div class="home--square"
  14.                    style="background-image: url('{{ page_block.cover_url }}')">
  15.                   <div class="home--content">
  16.                     <div class="home--content-wrapper">
  17.                       <div class="home--content-inner">
  18.                         <div class="swiper-text home--content-inner--padded">
  19.                             <h2>{{ page_block.title }}</h2>
  20.                             {% if page_block.subtitle %}
  21.                               <h3>{{ page_block.subtitle }}</h3>
  22.                             {% endif %}
  23.                             <a class="btn btn-secondary home__button" href="{{ page_block.url }}">
  24.                               {{ page_block.primary_button }}
  25.                             </a>
  26.                         </div>
  27.                       </div>
  28.                     </div>
  29.                   </div>
  30.                 </div>
  31.               </div>
  32.         {% endfor %}
  33.       </div>
  34.       <div class="swiper-pagination"></div>
  35.       <div class="swiper-button-prev"></div>
  36.       <div class="swiper-button-next"></div>
  37.       <div class="swiper-scrollbar"></div>
  38.     </div>
  39.     <script type="application/ld+json">{{ webpage_schema|safe }}</script>
  40.     <script src="https://cdnjs.cloudflare.com/ajax/libs/Swiper/4.2.6/js/swiper.min.js"></script>
  41.     <script src="https://code.jquery.com/jquery-3.3.1.min.js" integrity="sha256-FgpCb/KJQlLNfOu91ta32o/NMZxltwRo8QtmkMRdAu8=" crossorigin="anonymous"></script>
  42.   </div>
  43.   <script>
  44.       var swiper = new Swiper('.swiper-container', {
  45.           direction: 'vertical',
  46.           calculateHeight: true,
  47.           pagination: {
  48.               el: '.swiper-pagination',
  49.               clickable: true
  50.           },
  51.           autoplay: {
  52.               delay: 2500,
  53.               disableOnInteraction: false
  54.           }
  55.       });
  56.   </script>
  57. </body>
  58. {% endblock %}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement