加载的内容与阿贾克斯滚动时 [英] Loading content with ajax while scrolling

查看:116
本文介绍了加载的内容与阿贾克斯滚动时的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用jQuery插件工具作为图像滑块(形象在这里),但由于大量的图像,我需要加载它们很少的时间。由于它的JavaScript codeD,我不能有滚动条的位置,据我所知。我想尽快加载它们作为最后的图像显示出来,或类似的东西。我不知道在哪里,我把和事件侦听器没有任何东西。

I'm using jQuery Tools Plugin as image slider (image here), but due to large amount of images I need to load them few at a time. Since it's javascript coded, I can't have the scroll position as far as I know. I want to load them as soon as the last image shows up or something like that. I have no idea where I put and event listener neither anything.

下面是我的code http://jsfiddle.net/PxGTJ/

Here is my code http://jsfiddle.net/PxGTJ/

给我一些轻,请!

推荐答案

我不得不使用jQuery工具的API,在 onSeek 参数>滚动()方法。

I just had to use jQuery Tools' API, the onSeek parameter within the scrollable() method.

这是类似的东西。

$(".scrollable").scrollable({
    vertical: true,
    onSeek: function() {
        row = this.getIndex();
        // Check if it's worth to load more content
        if(row%4 == 0 && row != 0) {
            var id = this.getItems().find('img').filter(':last').attr('id');
            id = parseInt(id);
            $.get('galeria.items.php?id='+id, null, function(html) {
                $('.items').append(html);
            });
        }
    }
}); 

这篇关于加载的内容与阿贾克斯滚动时的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆