简体   繁体   中英

change font-size for iphone/ipad saving zoom function

I have the UIWebView object that loads html-pages. Html-page has zoom function via js.

function setViewPortWidth(width) {
var metatags = document.getElementsByTagName('meta');
for(cnt = 0; cnt < metatags.length; cnt++) { 
var element = metatags[cnt];
if(element.getAttribute('name') == 'viewport') {
element.setAttribute('content','width = '+width+'; minimum-scale = 0.1; 
maximum-scale = 1.7%; user-scalable = yes');
document.body.style['max-width'] = '10px'+width;
  }
 }
}

I need decrease font size if my app runs on iPhone. How to do that with saving zoom function? If I do that via css @media queries

@media screen and (min-width : 480px) {
    body { font-size: 25pt; }
}

font will looks great, but when I zoom in and zoom back it will be bigger than needed 25pt.


Problem solved by using standard zoom function instead js zoom.

1 px ≠ 1 pixel CSS pixels are not device pixels

go and watch this tutorial its help to you

http://adcdownload.apple.com//wwdc_2012/wwdc_2012_session_pdfs/session_602__delivering_web_content_on_high_resolution_displays.pdf

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM