$(function () {
$($('#pre-record-iframe')[0].contentWindow).on('click', function (e) {
$('#pre-record-iframe')[0].contentWindow.document.getElementById('maskDivId')?.remove();
var maskDiv = document.createElement('div');
maskDiv.id = "maskDivId"
maskDiv.style.position = "absolute"
maskDiv.style.background = "white"
maskDiv.style.top = "0"
maskDiv.style.left = "0"
maskDiv.style.right = "0"
let pageDoc = me.getParents(e.target, "page")
let pageContent = pageDoc?.getElementsByClassName('pagefooter')[0].innerText
let currentPageNum = Number(pageContent?.split('/')[0].replace(/[^0-9]/ig, ""))
// 插入div 算高度---问题:相对最近的父元素定位
// maskDiv.style.height = e.target.offsetTop + (currentPageNum - 1) * 1120.67 + 'px';
// e.target.appendChild(maskDiv);
console.log('e====', e.target.offsetTop);
// 以body定位的形式 ---问题:高度获取的不准确
if (char.length > 0)
ot = char[0].offsetTop
$('#pre-record-iframe')[0].contentWindow.document.body.firstChild.style.height = ot + 'px';
$('#pre-record-iframe')[0].contentWindow.document.body.firstChild.style.height = e.target.offsetTop + (currentPageNum - 1) * 1120.67 + 'px';
});
});
09-29
3121
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)
“相关推荐”对你有帮助么?
-
非常没帮助
-
没帮助
-
一般
-
有帮助
-
非常有帮助
提交