Disabling Easy FancyBox on Mobile Devices

This an addition to my “manual”, so that I can RT(my own)FM in future.

I use Easy FancyBox on this site to provide preview for media files like PDF, Images etc. I realise that the preview doesn’t work well on mobile. A lot of scrolling needed, so the preview is essentially useless.

There is no clickable option for the settings of Easy FancyBox to disable it on mobile devices. They do however, provide a simple and elegant solution on their GitHub site.

The idea is to disable theĀ easy_fancybox_handler function if the width of the displaying screen is found to be smaller than 641pixels.

I inserted the code using a Text Widget. To avoid confusion, I place it last of all the widgets.

Text Widget to disable Easy FancyBox
Text Widget to disable Easy FancyBox

This is a simple and elegant solution. There are complicated ones like going into the code for WordPress. But for maintainability, I think this is the cleanest and most elegant approach.

Tested this on an iPhone 5 and indeed, the plugin is disabled. Do leave me some feedback if you find that it is still loading on your mobile devices.


Author: yibi

YiBi's numb :) YiBi writes about anything. Technology, Gossips, Rubbish YiBi's a half f%#k geek :P

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.