Переглянути джерело

Bug Fix: Slide width was wrong when the window scrollbar was made hidden by the Layout component.

NaotoshiFujita 5 роки тому
батько
коміт
9f22a7a7a3

+ 7 - 2
dist/js/splide.esm.js

@@ -1,6 +1,6 @@
 /*!
  * Splide.js
- * Version  : 2.2.6
+ * Version  : 2.2.7
  * License  : MIT
  * Copyright: 2020 Naotoshi Fujita
  */
@@ -3712,6 +3712,7 @@ var THROTTLE = 100;
       height: unit(Layout.height)
     });
     var slideHeight = unit(Layout.slideHeight());
+    var width = Layout.width;
     Elements.each(function (Slide) {
       applyStyle(Slide.container, {
         height: slideHeight
@@ -3720,7 +3721,11 @@ var THROTTLE = 100;
         width: Splide.options.autoWidth ? null : unit(Layout.slideWidth(Slide.index)),
         height: Slide.container ? null : slideHeight
       });
-    });
+    }); // When the scrollbar is made hidden, the track width is changed but the resize event is not fired.
+
+    if (width !== Layout.width) {
+      resize();
+    }
   }
 
   return Layout;

+ 7 - 2
dist/js/splide.js

@@ -1,6 +1,6 @@
 /*!
  * Splide.js
- * Version  : 2.2.6
+ * Version  : 2.2.7
  * License  : MIT
  * Copyright: 2020 Naotoshi Fujita
  */
@@ -3702,6 +3702,7 @@ var THROTTLE = 100;
       height: unit(Layout.height)
     });
     var slideHeight = unit(Layout.slideHeight());
+    var width = Layout.width;
     Elements.each(function (Slide) {
       applyStyle(Slide.container, {
         height: slideHeight
@@ -3710,7 +3711,11 @@ var THROTTLE = 100;
         width: Splide.options.autoWidth ? null : unit(Layout.slideWidth(Slide.index)),
         height: Slide.container ? null : slideHeight
       });
-    });
+    }); // When the scrollbar is made hidden, the track width is changed but the resize event is not fired.
+
+    if (width !== Layout.width) {
+      resize();
+    }
   }
 
   return Layout;

Різницю між файлами не показано, бо вона завелика
+ 1 - 1
dist/js/splide.min.js


BIN
dist/js/splide.min.js.gz


+ 1 - 1
package.json

@@ -1,6 +1,6 @@
 {
   "name": "@splidejs/splide",
-  "version": "2.2.6",
+  "version": "2.2.7",
   "description": "Splide is a lightweight and powerful slider without any dependencies.",
   "author": "Naotoshi Fujita",
   "license": "MIT",

+ 6 - 0
src/js/components/layout/index.js

@@ -91,6 +91,7 @@ export default ( Splide, Components ) => {
 		applyStyle( Elements.track, { height: unit( Layout.height ) } );
 
 		const slideHeight = unit( Layout.slideHeight() );
+		const width       = Layout.width;
 
 		Elements.each( Slide => {
 			applyStyle( Slide.container, { height: slideHeight } );
@@ -100,6 +101,11 @@ export default ( Splide, Components ) => {
 				height: Slide.container ? null : slideHeight,
 			} );
 		} );
+
+		// When the scrollbar is made hidden, the track width is changed but the resize event is not fired.
+		if ( width !== Layout.width ) {
+			resize();
+		}
 	}
 
 	return Layout;

Деякі файли не було показано, через те що забагато файлів було змінено