[英]Load PHP include only when div is in viewport
我阅读和搜索,但我听不懂。 :(我有一个包含大量数据的HTML站点。所以我只想要这个:
例如:
<html>
<head>
<javascript code to load and check the visible of the divs>
</head>
<body>
<div id="i am visible because i am in the vieport>Some content</div>
.
.
.
<div id="i am the next div with included content, but i am not in the viewport on start, only when a user is scrolling><?php include 'somefile.php'; ?></div>
.
.
.
<div id="i am the next div with included content, but i am also not in the viewport on start, only when a user is scrolling><?php include 'somefile2.php'; ?></div>
.
.
</body>
</html>
请任何人能帮助我。 我擅长php,但我不太懂JavaScript :(
谢谢,RonnyDee
您所要求的必须使用客户端代码完成,这意味着在客户端(用户的浏览器)上执行的代码。 为此,您必须使用例如JavaScript。 在服务器端使用PHP无法做到这一点。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.