How to set viewport dynamically?

后端 未结 1 669
盖世英雄少女心
盖世英雄少女心 2020-12-10 00:06

If I want to change the viewport tag dynamically, what do I need to do?

For Mobile



        
1条回答
  •  难免孤独
    2020-12-10 00:31

    For sample :

    
    

    It sets the layout viewport width to 384 pixels. This works in most modern browsers; Nokia WebKit being the prime exception.

    You might want to give the layout viewport a width of 380px unless you’re on a widescreen (read tablet as you expect) device, in which case you might want to double it to 768. Or whatever.

    
    
    

    This script is executed automatically and changes the meta viewport tag directly.

    It’s also possible to force a change much later, after the page has been downloaded and rendered:

    
    
    

    0 讨论(0)
提交回复
热议问题