Site logo

Archived topic

Mobile Zoom

7 replies · Started by Mark on October 28, 2016

Viewing posts 1–8 of 8

Hi Tom,

I'm looking to stop mobile zooming on my website: http://www.fastbus.ie

The normal meta viewport tag doesn't seem to be working and I can't for the life of me find how to turn it off.

<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=0"/>

Any help appreciated!

Cheers,
Mark

You can remove the current meta tag like this:

add_action( 'after_setup_theme','tu_remove_viewport_meta' );
function tu_remove_viewport_meta()
{
    remove_action('wp_head','generate_add_viewport');
}

Then you can add your own in a function or GP Hooks :)

Cheers thanks for that Tom.

No problem :)

Hi,

To just turn off the mobile zoom so that it is not scalable,

What css should I add?

You could do this:

add_filter( 'generate_meta_viewport', 'tu_disable_mobile_zoom' );
function tu_disable_mobile_zoom() {
    return '<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">';
}

Hello,
As I can disable the pinch zoom on the mobile, I do not understand how to do it in the hooks.
thank you very much for your help

This archived topic is closed to new replies.