【问题标题】:Waypoints ain't working when scrolling too fast to the bottom滚动到底部太快时航点不起作用
【发布时间】:2012-05-21 14:13:12
【问题描述】:

在我的网站上:http://www.entendu.info/ 我正在使用来自http://imakewebthings.com/jquery-waypoints/ 的航点插件

如果用户直接滚动到底部,大多数路点都不会被触发,只有第一个和最后一个2个,好像中间的滚动太快而无法执行。 (航点是滚动时加载的社交按钮)

有什么帮助吗? PS : head.ready 只是使用 headjs 加载外部脚本时 document.ready 的替代。

head.ready(function() {

opts = {

        offset: '85%',
        continuous: 'true',

    };


 //$('.share-this').on('click', function(e){


$('.share-this').waypoint(function(event, direction) {
   if (direction === 'down') {


    var contentId = $('.share-this').attr('rel');
    var uri = $('.share-this').attr('rev');



    $.ajax({
   url: 'http://www.entendu.info/share',
   type: 'GET',
   dataType: 'html',
   data: {id:contentId, url:uri},
   complete: function(xhr, textStatus) {

   },
   success: function(data, textStatus, xhr) {

   $('#'+contentId).html(data);

   },
   error: function(xhr, textStatus, errorThrown) {

   }
   });


   }
   else {

      // do this on the way back up through the waypoint
   }
   //});

   $.waypoints('refresh')
   }, opts);



});

【问题讨论】:

  • 不是一个真正的答案,但您可以尝试使用存储库主分支上的版本而不是 1.1.6 版本。

标签: jquery scroll jquery-waypoints


【解决方案1】:

我相信您无需使用额外的 jQuery 插件即可实现您想要的。详细信息可以在这篇文章中找到,因此,如有必要,所有功劳归于。

How to check if a user has scrolled to the bottom

长话短说,您可以使用 jQuery 框架已经提供的scroll() 并将文档高度与当前显示的窗口高度进行比较。不过我不想抢别人的风头,请查看链接。

【讨论】:

    猜你喜欢
    • 2023-02-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-10-04
    • 2021-12-05
    • 2014-12-22
    • 2021-02-23
    • 1970-01-01
    相关资源
    最近更新 更多