Slick: Slide's Inline Style is Removed When Targeted by Responsive Breakpoints

Created on 9 May 2018  路  9Comments  路  Source: kenwheeler/slick

When using the responsive setting, inline style is removed from the slick wrapper's child (i.e. our content that is nested inside slick-slide) when they are targeted by a responsive breakpoint. This was largely unexpected because inline style is preserved if not targeted by responsive breakpoints. This affects both mobileFirst: true or false.

====================================================================

jsFiddle

http://jsfiddle.net/e1n5he7e/6/

====================================================================

Steps to reproduce the problem

  1. Add responsive settings
  2. Load page in layout that would not be affected by breakpoints (i.e. if not mobileFirst:true window size is greater than breakpoint) . Inline style should be preserved (in the jsFiddle inline style is simply color:red)
  3. Load and/or Resize page so that responsive breakpoint becomes active. Inline style will be replaced.

====================================================================

What is the expected behaviour?

  • inline style should be appended to by slick instead of replaced by slick
  • behavior would be consistent one-way or the other (either always replace inline-style or never replace-inline style - regardless of responsive settings)

====================================================================

What is observed behaviour?

  • inline style is replaced ONLY when affected by breakpoints

====================================================================

More Details

  • Chrome 66 OSX
  • jQuery 1.12.4
  • Slick 1.9.0
  • Did this work before? (I am unsure)

All 9 comments

I have the same issue...

I also have same problem ((
With version 1.6.0 all was good

As a temporary solution in line 826 need comment
originalSlides.removeAttr('style');

Can confirm this still happens.

Still a problem :/ Any news ?

I confirm that version 1.8.1 has the same bug but there is a catch!
The minified version is OK but not the non-minified! We have inline styles on our slides and they get striped on responsive breakpoint

@lillorme actually this works!! Bypassing the main element in slider..... hahaha
easy fix but works!

if you can not reach the html structure just wrap the item
$('.slick-container .slick-item').wrap('<div class="slick-item-wrapper"></div>');

Was this page helpful?
0 / 5 - 0 ratings