So I have my suffixes setup as follows:
_mobile - default
_narrow - 739px
_normal - 979px
Force Resize = yes
I also have the Omega Theme breakpoints set change at the same time (narrow at 740px, normal at 980px).
Works well in Chrome, Safari.
In FireFox (using the web developer toolbar), the image changes from the normal style to the narrow style at 996px, before Omega has changed the layout. Then the image changes from the narrow style to the mobile style at 756px (instead of at the expected 740px).
This seems, simply, to be an issue where the value that '$(window).width()' retrieves is not consistent between browsers.
Setup everything as it should (breakpoints that match Omega Media query layout changes) and it works fine in Chrome and Safari. In FireFox and IE9, the images controlled by Responsive Image and Styles are offset (in FF, by 17px.. the size of the vertical scrollbar).
If you'd like more info about the issue and perhaps some possible solutions that can be built into the module, see:
http://stackoverflow.com/questions/8472566/how-do-i-get-css-mediaqueries-to-work-with-jquery-window-innerwidth
http://www.quirksmode.org/blog/archives/2010/08/combining_media.html (in the Javascript pairing section)
http://stackoverflow.com/questions/833699/clientheight-clientwidth-returning-different-values-on-different-browsers
Is there something we can do to fix this in the jQuery logic? We need to be able to call these different images in a precise manner.
Thanks!
Comments
Comment #1
attiks commentedI saw the same behaviour, we added some logic to detect the width of the scrollbar, but i think it's only inside the latest dev version.
Comment #2
kirkofalltrades commentedI see the code in the dev version that looks like it tries to address the issue, but I cannot get the dev version to work. http://drupal.org/node/1632428
Thanks!
Comment #3
kirkofalltrades commentedFigured out the dev version issue. See that issue for more details.
The dev versions calculation of the width is much better.
With suffixes setup like before, starting at the wide end, the images change as follows:
@977px, image changes from normal to narrow style
@937px, image changes from narrow to mobile style
This is now only a couple pixels off and since the layout breaks prior to this change (and it's easier to make a large image scale to fit than it is to make a smaller image scale to fit), this works for me.
However, Firefox width calculation includes any sidebars you may have attached to that window (such as the history bar, or Firebug when attached to the right or left side of the browser). I also noticed the same behavior with Chrome when the debugging UI was open and attached to the right. Not sure if a different (better) solutions wants to be pursued, but thought I should point it out.
Thanks!
Kirk
Comment #4
attiks commented