Open damanic opened 7 years ago
I was having the same issue, where chrome was intermittently showing our gallery images as way too large. I ended up adding this additional check to the Slick.prototype.setDimensions function:
_.listWidth = _.$list.width();
_.listHeight = _.$list.height();
// If the carousel is larger than the browser window, we are experiencing the chrome width issue.
if (_.listWidth > $(window).width()) {
_.listWidth = $(window).width() - parseInt(_.$list.css('padding-left')) - parseInt(_.$list.css('padding-right'));
}
That is just a band-aid, but seems to get things working fine on our site.
I found a strange issue with Chrome where clean page loads (CTRL F5) would calculate one set of dimensions and a browser cached page load would produce another. This relates to the centerMode option where CSS padding is added to the slick container. The addition of padding normally reduces the elements width() and keeps the innerWidth() the same. However in Chrome it was increasing the innerWidth and keeping the width() the same. This only occurred on the browser cached refreshes.
The only way I could get around the problem was to update the function as follows:
Steps to reproduce the problem
====================================================================
What is the expected behaviour?
innerWidth() and width() should return consistent results
====================================================================
What is observed behaviour?
innerWidth() and width() return inconsistent results
====================================================================
Found on