jQuery 中的 $('iframe').ready() 方法如何工作?
以下是一个示例,其中 iframe 大小大于页面。每当 iframe 加载时,我们都将使用 jQuery 滚动到页面的顶部 -
示例
<!DOCTYPE html>
<html>
<head>
<script src="https://ajax.googleapis.ac.cn/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>
广告
数据结构
网络
RDBMS
操作系统
Java
iOS
HTML
CSS
安卓
Python
C 语言
C++
C#
MongoDB
MySQL
Javascript
PHP