Advertisement
ikai2

add arrows to the product media

Aug 20th, 2022 (edited)
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /*CSS Code*/
  2.  
  3. [data-pf-type="MainMedia"] .splide__arrows button:disabled, [data-pf-type="MainMedia"] .splide__pagination:first-of-type,[data-pf-type="ProductList"] .splide__pagination:first-of-type {
  4. display: none !important;
  5. }
  6.  
  7. /*JS Code*/
  8.  
  9. const getElemIdByClassname = className => className ? className.split(' ').find(cl => cl.match(/pf-(\d)+_/)) : null
  10. setTimeout(() => {
  11. const productMedia = document.querySelectorAll('[data-pf-type="ProductMedia"]')
  12. productMedia.forEach(el => {
  13.     const productId = el.getAttribute('data-product-id')
  14.     const elId = getElemIdByClassname(el.className)
  15.     const sliderId = elId + productId
  16.     window.mainSlider[sliderId].options.arrows = true
  17.     window.mainSlider[sliderId].options.arrowPath = 'm15.5 0.932-4.3 4.38 14.5 14.6-14.5 14.5 4.3 4.4 14.6-14.6 4.4-4.3-4.4-4.4-14.6-14.6z'
  18.     window.mainSlider[sliderId].mount()
  19. })
  20. },1500)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement