Disable lightbox for mobile?
Permalink Browser Info Environment
Hi,
can you please tell me what would be best practice to disable the lightbox for mobile on a custom template, in order to show only thumbnails (one column) on screens with max-width 420px for example?
Thank you,
Michael
can you please tell me what would be best practice to disable the lightbox for mobile on a custom template, in order to show only thumbnails (one column) on screens with max-width 420px for example?
Thank you,
Michael
Type: | Discussion |
---|---|
Status: | Resolved |
Cool, thank you for implementing that feature!
The only 'problem' is, that it doesn't work dynamically:
if a gallery is viewed on a smartphone in landscape mode, where the lightbox still makes sense (mobile width set to 480px for example) and the device is turned, switching to portrait mode, the lightbox is still active.
Same behavior of course is true for the other way round:
Using a smartphone in portrait mode, one may like to view images in the lightbox, but after switching to landscape mode, this is still not possible, except for the page is reloaded.
Of course i understand, if there is no dynamic solution for detecting changing screen widths in JS as things work in CSS with media queries.
Thank you,
Michael
The only 'problem' is, that it doesn't work dynamically:
if a gallery is viewed on a smartphone in landscape mode, where the lightbox still makes sense (mobile width set to 480px for example) and the device is turned, switching to portrait mode, the lightbox is still active.
Same behavior of course is true for the other way round:
Using a smartphone in portrait mode, one may like to view images in the lightbox, but after switching to landscape mode, this is still not possible, except for the page is reloaded.
Of course i understand, if there is no dynamic solution for detecting changing screen widths in JS as things work in CSS with media queries.
Thank you,
Michael
Hi,
it's great that you implemented the option to disable the lightbox for mobile screens.
Unfortunately, while it should be possible to set a custom value for maximum screen width up from 0 (which should completely disable it), there is still a value of 600 hardcoded in controller.php of the block. I don't know if this is intentionally, or just a leftover of a previous version. It seems that this value does not get overridden by custom values less than 600 pixels. If, for example, a custom width of 320 pixels is set for a gallery block, the lightbox will still be disabled on screen widths of equal or less than 600 pixels.
Only commenting out the code on line 742 of the block's controller.php solved the problem:
Thank you,
Michael
it's great that you implemented the option to disable the lightbox for mobile screens.
Unfortunately, while it should be possible to set a custom value for maximum screen width up from 0 (which should completely disable it), there is still a value of 600 hardcoded in controller.php of the block. I don't know if this is intentionally, or just a leftover of a previous version. It seems that this value does not get overridden by custom values less than 600 pixels. If, for example, a custom width of 320 pixels is set for a gallery block, the lightbox will still be disabled on screen widths of equal or less than 600 pixels.
Only commenting out the code on line 742 of the block's controller.php solved the problem:
// $this->gallery->optionsObj->lInactiveonMobile = 600;
Thank you,
Michael
Hi,
Yep, I forgot to remove that line. Thanks for the heads-up.
Yep, I forgot to remove that line. Thanks for the heads-up.
Plz upgrade to latest version (2.4.0) which include an option for disable lighbox on the mobile devices.
Cheers,