扫码关注官方订阅号
我目前有一个以下形式的页面
有什么办法可以滚动
用jquery?
我尝试了不同的插件,但它们都在 mvc 中触发多个事件时遇到问题,所以我使用 underscore.js 想出了这个解决方案
<script type="text/javascript"> $(document).ready(function () { var isc = _.throttle(function (event) { if ($(window).scrollTop() + $(window).height() > $(document).height() - 200) { if (event.handled !== true) { $.post('@path', function (html) { $('#user-feed').append(html); }); } } }, 300); $(window).scroll(isc); }); </script>
微信扫码关注PHP中文网服务号
QQ扫码加入技术交流群
Copyright 2014-2026 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号
PHP学习
技术支持
返回顶部
我尝试了不同的插件,但它们都在 mvc 中触发多个事件时遇到问题,所以我使用 underscore.js 想出了这个解决方案
<script type="text/javascript"> $(document).ready(function () { var isc = _.throttle(function (event) { if ($(window).scrollTop() + $(window).height() > $(document).height() - 200) { if (event.handled !== true) { $.post('@path', function (html) { $('#user-feed').append(html); }); } } }, 300); $(window).scroll(isc); }); </script>