Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

swiper js JS

import "bootstrap/dist/css/bootstrap.min.css";
import "swiper/dist/css/swiper.min.css";
import './style.css';
import $ from "jquery";
import "bootstrap/dist/js/bootstrap.bundle.min.js";
import Swiper from "swiper";

$(document).ready(function() {
  var parallaxSlider;
  var parallaxSliderOptions = {
    speed: 1000,
    autoplay: true,
    parallax: true,
    loop: true,
    grabCursor: true,
    centeredSlides: true,
    pagination: {
      el: '.swiper-pagination',
      clickable: true
    },
    on: {
      init: function() {
        let swiper = this;
        for (let i = 0; i < swiper.slides.length; i++) {
          $(swiper.slides[i])
            .find('.img-container')
            .attr({
              'data-swiper-parallax': 0.75 * swiper.width,
              'data-swiper-paralalx-opacity': 0.5
            });

          $(swiper.slides[i])
            .find('.title')
            .attr('data-swiper-parallax', 0.65 * swiper.width);
          $(swiper.slides[i])
            .find('.description')
            .attr('data-swiper-parallax', 0.5 * swiper.width);
        }
      },
      resize: function() {
        this.update();
      }
    },
    navigation: {
      nextEl: '.parallax-slider .next-ctrl',
      prevEl: '.parallax-slider .prev-ctrl'
    }
  };

  parallaxSlider = new Swiper('.parallax-slider', parallaxSliderOptions);
  $(window).on('resize', function() {
    parallaxSlider.destroy();
    parallaxSlider = new Swiper('.parallax-slider', parallaxSliderOptions);
  });
});
Comment

Js Swiper

$ npm install swiper
Comment

swiper js

<link
  rel="stylesheet"
  href="https://cdn.jsdelivr.net/npm/swiper@8/swiper-bundle.min.css"
/>

<script src="https://cdn.jsdelivr.net/npm/swiper@8/swiper-bundle.min.js"></script>
Comment

Js Swiper

// import Swiper JS
import Swiper from 'swiper';
// import Swiper styles
import 'swiper/swiper-bundle.css';

const swiper = new Swiper(...);
Comment

PREVIOUS NEXT
Code Example
Javascript :: tailwind rn npm install 
Javascript :: how to find remainder in javascript 
Javascript :: coreui react change background color 
Javascript :: addition of time in javascript 
Javascript :: how to search and filter js 
Javascript :: difference node and npm 
Javascript :: momoent isafter or equal$ 
Javascript :: box shadow generador react native 
Javascript :: sequelize db:create test environment 
Javascript :: react pdf 
Javascript :: array reduce 
Javascript :: how to stop overlapping divs to interact with each others click events 
Javascript :: javascript get first element of array 
Javascript :: Jest DOM Manipulation 
Javascript :: print stuff in console javascript 
Javascript :: react electron desktop app 
Javascript :: jquery numeric validation 
Javascript :: sprintf js 
Javascript :: convert positive to negative number javascript 
Javascript :: components should be written as a pure function 
Javascript :: call a javascript function at a specific time of day 
Javascript :: react hooks update parent state from child 
Javascript :: JavaScript if, else, and else if 
Javascript :: routes in angular 
Javascript :: how ot send user agent in nodejs https header 
Javascript :: promise.all jquery ajax 
Javascript :: how can I send form data with image in angular 
Javascript :: react hook state not updating immediately 
Javascript :: array from javascript 
Javascript :: reduce in js 
ADD CONTENT
Topic
Content
Source link
Name
5+3 =