Enable Mobile Pinch Zooming in Divi

|

By default, the Divi Theme disables "pinch" zooming on mobiles. While this gives you more control over how your site appears to users, it can hurt accessibility as vision impaired users will be unable to zoom in to view content.

Google's Lighthouse website auditing tool, will report a site with zooming disabled as an accessibility fail, like so:

The follow methods will let you enable zooming, pass this Lighthouse accessibility check and adhere to accessibility best practice.

Enable Zooming using Definitely Allow Mobile Zooming

If you'd like to enable pinch zooming, you can either use a plugin such as Definitely allow mobile zooming, or use the following PHP code:

Enable Zooming using Divi Booster

If you are using Divi Booster, you can enable zooming using the following setting:

Divi > Divi Booster > Site-wide Settings > Accessibility > Enable Zooming

Enable Zooming using PHP

You can manually enable zooming use the following PHP code:

add_action('after_setup_theme', 'db_remove_et_viewport_meta');
add_action('wp_head', 'db_enable_pinch_zoom');

function db_remove_et_viewport_meta() {
	remove_action('wp_head', 'et_add_viewport_meta');
}

function db_enable_pinch_zoom() {
	echo '<meta name="viewport" content="width=device-width, user-scalable=yes, initial-scale=1.0, minimum-scale=0.1, maximum-scale=10.0">';
}

Both the plugin methods and the PHP code add a "meta tag" to the source code your web pages which instructs mobile devices to enable pinch zooming.

A slight benefit of the Divi Booster / PHP code over the Definitely allow mobile zooming plugin is that it will also remove the meta tag Divi adds to prevent pinch zooming, and thus avoid having an unnecessary extra meta tag showing up in the source code.

This post may contain referral links which may earn a commission for this site

Hundreds of new features for Divi
in one easy-to-use plugin

2 Comments

  1. Thank you for adding this to Divi Booster, brilliant. I contacted ET support a while back about this and they provided some code to override it which I have to manually add to sites but as always you make things so easy – tick the box, job done!

    Reply
    • You’re welcome, md51gnd. Glad it helps :)

      Reply

Submit a Comment

Your email address will not be published. Required fields are marked *