e1commerce.com
Ask a question
  • New questions
  • With the answers
  • Unanswered
  1. Home
  2. java - Featured collection shopify with Swiper JS

270 votes
0 answers

java - Featured collection shopify with Swiper JS

im working on a new featured collection section with swiper JS, but i found some issues on  my way, if anyone can help me to solve that, let's start:

at first of all i wanna say thanks to everyone who can help me ‌‌

okay, this is my code at the moment, using Swiper JS v8.3.2 and Tailwind CSS v3.1

<!-- Initialize Swiper -->
<script>
    window.addEventListener('load', function() {
      const swiper = new Swiper(".mySwiper", { // Optional parameters
          direction: "horizontal",
          slidesPerView: 1,
          loop: true,
          lazyLoading: true,
          keyboard: {
            enabled: true
          },

          // If we need pagination
          pagination: {
              el: ".swiper-pagination"
          },

          // Navigation arrows
          navigation: {
              nextEl: ".swiper-button-next",
              prevEl: ".swiper-button-prev"
          },
      });
  });
</script>
<div class="flex flex-col items-center px-0 lg:px-8">
  {% if section.settings.title != blank %}
    <h2
      class="{{ section.settings.align_text }} font-bold uppercase mt-20 mb-10"
      style="font-size: {{ section.settings.font_size }}px"
    >
      {{ section.settings.title | escape }}
    </h2>
  {% endif %}

  <div class="max-w-full mx-auto">
    {% if section.settings.slider_enabled %}
      <!-- Swiper -->
      <div class="swiper mySwiper">
        <div class="swiper-wrapper">
          <div class="swiper-slide flex w-full">
            {%- for product in section.settings.featured_collection.products limit: section.settings.number_of_products_to_show -%}
              <div class="
                  {{ section.settings.items_per_row_mobile }}
                  {{ section.settings.items_per_row_tablet }}
                  {{ section.settings.items_per_row }} shrink-0 px-1 md:px-3
                ">
                {%
                  render 'product-card',
                  product: product,
                  show_secondary_image: section.settings.show_secondary_image
                %}
              </div>
            {%- endfor -%}
          </div>
        </div>
        <div class="swiper-button-next"></div>
        <div class="swiper-button-prev"></div>
        <div class="swiper-pagination"></div>
      </div>
    {% endif %}
  </div>
</div>

Undefined asked
2022-11-11


Source

Didn't find the answer?

Our community is visited by hundreds of Shopify development professionals every day. Ask your question and get a quick answer for free.

Ask a Question

Similar questions

Find the answer in similar questions on our website.

10 liquid - Shopify & Alpine.js how to render a collection for button that is clicked
307 Get Shopify JSON metafield as raw JSON data
68 reactjs - Can I use Next.js frontend app as Block in Shopify's Theme App Extensions instead of liquid?
875 node.js - How to create a REST request using the Shopify Node JS API for a Private App?
702 python - Most efficient way to transform a JS React app/widget into a public shopify-app on the Shopify store
932 json - Adding a specific collection to a specific page in Shopify
206 javascript - Shopify - Facing issue when creating customer using shopify api
604 node.js - How to get URL of shop in Shopify embeded app?
107 shopify - How to verify the Access Token on the Shopify_App splash Screen
657 javascript - How to add custom textbox field on shopify product page that also shown in cart under product description

Write quick answer

Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.







Latest questions:

16 javascript - Redeclaration of Let error - How to find where it's being reassigned?

543 Can we develop plugins for shopify using MERN stack?

778 javascript - Shopify - Facing issue when creating customer using shopify api

404 javascript - add class on scroll not working in Shopify enviroment

314 json - Adding a specific collection to a specific page in Shopify



© 2021

E-mail: infot@e1commerce.com