Bootstrap is a good front-end UI development framework, especially in the development of Adaptive Web applications. We encountered a small problem in the development of our project: Bootstrap became small on the Windows Phone 8 screen. The reason is:
The bootstrap.css file contains such a line.Code:
@-MS-viewport {
Width: Device-width;
}
The function of this line of code is: the page width is set to the width of the device. In reality, I am not the result I want, we need to automatically adapt according to the content of my web page.
The following solution code (in the header script ):
If (navigator. useragent. Match (/iemobile \/10 \. 0 /)){
VaR msviewportstyle = Document. createelement ("style ");
Msviewportstyle. appendchild (
Document. createtextnode (
"@-MS-viewport {width: Auto! Important }"
)
);
Document. getelementsbytagname ("head") [0].
Appendchild (msviewportstyle );
}