Skip to content Skip to sidebar Skip to footer

Can I Stop The Resizing Of Elements On Zoom?

I have a standard website, and when the user zooms in (CTRL +), how can I prevent elements from resizing?

Solution 1:

There's no way I know of to prevent items from scaling when a user zooms in. There may be a way to catch the zoom event and size elements accordingly, but it won't work in all browsers.

And to state the obvious - people zoom in because they can't read/see it at normal zoom. Pleeeaase don't break standard behaviour. It's there for a reason.

Solution 2:

you can disable the cntl button with this:

<scriptlanguage="JavaScript">functiondisableCtrlKeyCombination(e)
{
        //list all CTRL + key combinations you want to disablevar forbiddenKeys = newArray(‘+’);
        var key;
        var isCtrl;

        if(window.event)
        {
                key = window.event.keyCode;     //IEif(window.event.ctrlKey)
                        isCtrl = true;
                else
                        isCtrl = false;
        }
        else
        {
                key = e.which;     //firefoxif(e.ctrlKey)
                        isCtrl = true;
                else
                        isCtrl = false;
        }

        //if ctrl is pressed check if other key is in forbidenKeys arrayif(isCtrl)
        {
                for(i=0; i<forbiddenkeys .length; i++)
                {
                        //case-insensitive comparationif(forbiddenKeys[i].toLowerCase() == String.fromCharCode(key).toLowerCase())
                        {
                                alert(‘Key combination CTRL + ‘
                                        +String.fromCharCode(key)
                                        +‘ has been disabled.’);
                                returnfalse;
                        }
                }
        }
        returntrue;
}
</script>

Post a Comment for "Can I Stop The Resizing Of Elements On Zoom?"