Browse Source

fucking min width

Ivan Asmer 3 years ago
parent
commit
322910bf1e
2 changed files with 2 additions and 2 deletions
  1. 1 1
      example/src/App.js
  2. 1 1
      src/index.js

+ 1 - 1
example/src/App.js

@@ -1,7 +1,7 @@
 import React from 'react'
 
 import { SliderImage } from 'react-scrollable-slider'
-import 'react-scrollable-slider/dist/index.css'
+//import 'react-scrollable-slider/dist/index.css'
 
 const images = ["images/7eda725de98d7b4a23489988a334e726_375.jpeg", "images/fa0cfb2c2f540f33eb179ab1af2a4416_375.jpeg", "static/media/banner_hor2.a5496732.png", "images/7eda725de98d7b4a23489988a334e726_375.jpeg", ].map(img => "https://mo-cosmetics.com/" + img)
 

+ 1 - 1
src/index.js

@@ -16,7 +16,7 @@ export const SliderImage = ({images = [], className, onChange, onClick, ...props
             const div  = divRef.current
 
             const totalWidth = imgs.reduce((total, img) => total + (img?.getBoundingClientRect().width || 0),0)
-            div.style.width = totalWidth + 'px'
+            div.style.minWidth = totalWidth + 'px'
         }
     }, [divRef, imgs])