$('iframe').ready() 方法在 jQuery 中如何工作?
jqueryweb developmentfront end technology
这里有一个 iframe 尺寸大于页面的示例。我们将使用 jQuery 减法,在 iframe 加载时滚动到页面顶部。
示例
<!DOCTYPE html>
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<script>
$(document).ready(function(){
$("button").click(function(){
$('iframe').ready(function(){
$(window).scrollTop(0);
});
});
});
</script>
</head>
<body>
<iframe frameborder="2" height="900" id="iframe" align="top" src="https://www.qries.com" width="900" ></iframe><br>
<button>Loop through each image</button>
</body>
</html>

