diff --git a/examples/hello-mui/examples/ad.html b/examples/hello-mui/examples/ad.html index 94f7dfbc..127d59bd 100644 --- a/examples/hello-mui/examples/ad.html +++ b/examples/hello-mui/examples/ad.html @@ -64,6 +64,9 @@

advertisement(广告模板)

var adBottom = mui.os.ios?('-'+adHeight+'px'):'0'; var ad = plus.webview.create(url,'ad',{height:adHeight+'px',bottom:adBottom,position:"absolute"}); + + ad.appendJsFile('_www/js/ad.js'); + //目前Android平台不支持子webview的setStyle动画,因此分平台处理; if(mui.os.ios){ //为了支持iOS平台左侧边缘滑动关闭页面,需要append进去; @@ -82,8 +85,6 @@

advertisement(广告模板)

}); } - ad.appendJsFile('_www/js/ad.js'); - //设置主页面的底部留白,否则会被遮住; document.querySelector('.mui-content').style.paddingBottom = adHeight + 'px'; } diff --git a/examples/hello-mui/js/ad.js b/examples/hello-mui/js/ad.js index a64fd033..f9d86598 100644 --- a/examples/hello-mui/js/ad.js +++ b/examples/hello-mui/js/ad.js @@ -12,4 +12,12 @@ document.querySelector("body").addEventListener('click',function (event) { },true); - +(function appendVW() { + var content = 'width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no'; + if(!document.querySelector('meta[name=viewport]')) { + var meta = document.createElement('meta'); + meta.name = 'viewport'; + meta.content = content; + document.getElementsByTagName('head')[0].appendChild(meta); + } +})();