FlexSlider icon indicating copy to clipboard operation
FlexSlider copied to clipboard

Why isn't the viewport width being used for Firefox?

Open dennisnissle opened this issue 6 years ago • 7 comments

Hi there,

I've been analyzing a width-problem for slider images when using FF which leads to images being wider than the actual viewport. In slider.doMath function there is a line (since latest release) which uses the slider.width instead of the slider.viewport.width for Firefox specifically:

if (slider.isFirefox) { slider.w = slider.width(); }

https://github.com/woocommerce/FlexSlider/blob/master/jquery.flexslider.js#L1009

That leads to the problem that when using vertical thumbnails next to the gallery, the slider image width is calculated based on the total slider width which includes the thumbnail width instead of applying the viewport width (which is being used for all the other browsers). Seems like a bug to me. For a demo please see: http://demo.vendidero.de/produkt/vendichique-evening-blue/

Cheers

dennisnissle avatar Jun 18 '18 09:06 dennisnissle

Same problem. Depending of the image, it could be not displayed properly. The image can be seen cutted from the right side.

javialm avatar Jun 18 '18 14:06 javialm

Could be a solution?

replace at line 1009 this: if (slider.isFirefox) { slider.w = slider.width(); } by this if (slider.isFirefox) { slider.w = slider.slides.parent().parent().first().width(); }

javialm avatar Jun 18 '18 14:06 javialm

Also seeing the same problem. Image width is calculated incorrectly on Firefox, and displayed partially off the right edge of the viewport.

rogercoathup avatar Oct 31 '20 12:10 rogercoathup

Same here, live example https://impreza15.us-themes.com/product/ankle-strap-sandals/

IvanBalakirev avatar Apr 15 '21 07:04 IvanBalakirev

Three years later. Any updates on this?

scheurta avatar Jun 16 '21 11:06 scheurta

Is this jQuery plugin maintained at all? At least in modern Firefox, the Firefox width calculation is off.

pembo13 avatar Aug 31 '21 16:08 pembo13

Hello, I just fixed that issue by overwriting the minified jquery file from woocommerce/assets/js/flexslider/jquery.flexslider.min.js

I changed this : m.isFirefox&&(m.w=m.width()) To this : m.isFirefox&&(m.w=m.viewport()) <- UPDATE : Do not wore anymore

It will use the width of the viewport in place of the entire slider.

Wish this can help! Its worked perfectly for me as i use the thumbmails on left side.

EDIT : After an auto-update, my fix didnt work anymore (log error : m.viewport is not a function...).. I actually dont know why but this new edit do the job :

NEW FIX :

change this : m.isFirefox&&(m.w=m.width()) to this : m.isFirefox&&(m.w=(m.viewport===undefined?m:m.viewport).width())

There is for sure better way to handle this but i'm still learning and haven't actually the time to focus on that..

loptimisator avatar Feb 24 '22 04:02 loptimisator