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

Type: Discussion
Status: Resolved
okapi
View Replies:
shahroq replied on at Permalink Reply
shahroq
Hi,
Plz upgrade to latest version (2.4.0) which include an option for disable lighbox on the mobile devices.
Cheers,
okapi replied on at Permalink Reply
okapi
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
okapi replied on at Permalink Reply
okapi
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:

// $this->gallery->optionsObj->lInactiveonMobile = 600;

Thank you,
Michael
shahroq replied on at Permalink Reply
shahroq
Hi,
Yep, I forgot to remove that line. Thanks for the heads-up.

concrete5 Environment Information

Concrete5 8.3.1
PHP 7

Browser User-Agent String

Mozilla/5.0 (Macintosh; Intel Mac OS X 10.13; rv:57.0) Gecko/20100101 Firefox/57.0

Hide Post Content

This will replace the post content with the message: "Content has been removed by an Administrator"

Hide Content

Request Refund

You may not request a refund that is not currently owned by you.