1个回答
展开全部
用其他容器滚动来替代iframe的滚动,把iframe的scrolling设置为no
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title></title>
<script type="text/javascript" src="jquery-1.3.1.js"></script>
<script type="text/javascript">
$(function() {
var frame = $("#frame");
var win = frame[0].contentWindow;
$(win).load(function() {
var dom = win.document;
$(dom.body).css({margin:'0',padding:'0',border:'0',width:'100%',height:'100%'})
.html(
'<div id="layer" style="width:100%;height:100%;overflow:auto;background:red;">' +
'<div style="width:1000px;height:1000px;">scroll' +
'</div>' +
'</div>'
);
$("#layer", dom.body).scroll(function() {
alert('invoke');
});
})
});
</script>
</head>
<body>
<iframe id="frame" frameborder="2" scrolling="no" src="about:blank" style="width:300px;height:200px;"></iframe>
</body>
</html>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title></title>
<script type="text/javascript" src="jquery-1.3.1.js"></script>
<script type="text/javascript">
$(function() {
var frame = $("#frame");
var win = frame[0].contentWindow;
$(win).load(function() {
var dom = win.document;
$(dom.body).css({margin:'0',padding:'0',border:'0',width:'100%',height:'100%'})
.html(
'<div id="layer" style="width:100%;height:100%;overflow:auto;background:red;">' +
'<div style="width:1000px;height:1000px;">scroll' +
'</div>' +
'</div>'
);
$("#layer", dom.body).scroll(function() {
alert('invoke');
});
})
});
</script>
</head>
<body>
<iframe id="frame" frameborder="2" scrolling="no" src="about:blank" style="width:300px;height:200px;"></iframe>
</body>
</html>
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询