Skip Navigation

[Resolved] turn off lightbox on mobile

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

This topic contains 7 replies, has 2 voices.

Last updated by Marisa 6 years, 1 month ago.

Assigned support staff: Shane.

Author
Posts
#322326

hidden link

The images under this section have a lightbox applied.

I don't want this on mobile.

I read this post: https://toolset.com/forums/topic/view-rendering-on-mobile-device/

But want it to be turned off on any device under 414px wide.

This is the current shortcode configuration.


<div class="uk-third"><a href='[wpv-post-featured-image size="large" output="url"]' class="thickbox">[wpv-post-featured-image size="full"]</a></div>

How can I change this to hide it on mobile? Thanks.

#322344

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Marisa,

It seems that you are using a plugin to create the lightbox on the images.

Unfortunately there isn't much we can do here since the plugin for the lightbox was not developed by us.

I would suggest that you contact the support team for the plugin directly.

However you can try adding this javascript below to the JS Editor on your view.

jQuery("document").ready(function($){
	if(jQuery(window).width() < 514) {
   jQuery(".uk-third a").removeClass('thickbox');
}
});

I cant guarantee that this will work but it's worth a shot.

Thanks

#322349

Thanks. Perhaps it's better if ask the best way to do a lightbox or popup with Types and Views. I was just trying to solve the issue on my own.

Is there a Views friendly way to do this? I don't have any plugins installed for photo boxes, btw. I think this is a wordpress default thing.

(The above opens the image but without the lightbox overlay).

#322351

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Marisa,

Our view plugin or types don't offer any lightbox. Lightbox plugins can be used to open the images in lightboxes.

The reason why your images open in a lightbox is because you have a class being applied.
class="thickbox"

It could be your theme applying the lightbox as wordpress does not use lightboxes for the images.

Maybe you could try contacting the theme's support.

To confirm that its the theme could you switch to a default theme temporarily just to check if the images will still open in a lightbox.

Thanks

#322352

I applied the class "thickbox" to open in desktop versions of the site.

I do not want it on the mobile version, as the popup images are smaller than the original ones.

#322374

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Marisa,

With the javascript I had provided it removes the lightbox on mobiles.

However since your images were created as a link, when the user clicks on the link on a mobile device then they will be taking to the image itself since you are setting the url in the link itself using our shortcode.

The only way to prevent this is to remove the A tag all together for mobiles and just use our shortcode directly.

Thanks

#322378

I have a hard time believing this is the best way to do this. You can't just "remove" a link on mobile. Do you mean I should create two different divs? What do you mean?

Of course I want the lightbox on desktop. It's mobile I don't want it on.

#322384

I think I resolved it with two different divs.