create-shadow.js 498 B

12345678910111213
  1. import $ from './dom.js';
  2. export default function createShadow(params, $slideEl, side) {
  3. const shadowClass = `swiper-slide-shadow${side ? `-${side}` : ''}`;
  4. const $shadowContainer = params.transformEl ? $slideEl.find(params.transformEl) : $slideEl;
  5. let $shadowEl = $shadowContainer.children(`.${shadowClass}`);
  6. if (!$shadowEl.length) {
  7. $shadowEl = $(`<div class="swiper-slide-shadow${side ? `-${side}` : ''}"></div>`);
  8. $shadowContainer.append($shadowEl);
  9. }
  10. return $shadowEl;
  11. }