H5 前端 如何修改iframe 内置网页的样式

作者 : admin 本文共473个字,预计阅读时间需要2分钟 发布时间: 2024-06-10 共2人阅读

调用iframe load 的方法

loadFrame(){let pdf = document.querySelector(‘#pdf iframe’).contentDocument

contentDocument 也可为contentWindow

H5 前端 如何修改iframe 内置网页的样式插图

个人认为主要是看是内置是html 还是文件

let body = pdf.queryselector(‘body’)

let title = body.queryselector(‘.header’)

title.style.display = ‘none’

let content = body.querySelector(‘#outercontainer’)
content.style.marginTop=-53px

body.style.backgroundcolor=’white

body.style.backgroundImage=’none

//body.style.removeProperty(‘background-image’)console.log(pdf,body,title,content,’—-0000000′);

本站无任何商业行为
个人在线分享 » H5 前端 如何修改iframe 内置网页的样式
E-->