无限滚动随机图像专辑

时间:2014-09-24 22:02:36

标签: html scroll infinite

我需要一个简单的页面来加载来自特定文件夹的所有图像,以随机的顺序显示它们,一个接一个地放置它们,制作一个"无限的"垂直滚动页面:)

类似于http://jasmin.com(NSFW)

2 个答案:

答案 0 :(得分:0)

有一个名为infinite-scroll的jQuery插件可以完成大部分描述。它的方法允许您决定何时向页面加载更多内容,要加载什么以及在何处加载。我相信它的核心功能是$('.selector').infinitescroll('scroll');

修改
如果此解决方案过于复杂,则在stackoverflow herehere上有一个简单的滚动检测示例。

答案 1 :(得分:-1)

首先我将所有的zip内容上传到我的ftp。

在此之后我添加了:

    <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.9.0/jquery.min.js"></script>
    <script type="text/javascript" src="http://rfactorstreetcarstracks.altervista.org/jquery.infinitescroll.js"></script>


    <script type="text/javascript">
$('.selector').infinitescroll({
  loading: {
    finished: undefined,
    finishedMsg: "<em>Congratulations, you've reached the end of the internet.</em>",
                img: null,
    msg: null,
    msgText: "<em>Loading the next set of posts...</em>",
    selector: null,
    speed: 'fast',
    start: undefined
  },
  state: {
    isDuringAjax: false,
    isInvalidPage: false,
    isDestroyed: false,
    isDone: false, // For when it goes all the way through the archive.
    isPaused: false,
    currPage: 1
  },
  behavior: undefined,
  binder: $(window), // used to cache the selector for the element that will be scrolling
  nextSelector: "div.navigation a:first",
  navSelector: "div.navigation",
  contentSelector: null, // rename to pageFragment
  extraScrollPx: 150,
  itemSelector: "div.post",
  animate: false,
  pathParse: undefined,
  dataType: 'html',
  appendCallback: true,
  bufferPx: 40,
  errorCallback: function () { },
  infid: 0, //Instance ID
  pixelsFromNavToBottom: undefined,
  path: "/", // Can either be an array of URL parts (e.g. ["/page/", "/"]) or a function that accepts the page number and returns a URL
  maxPage:undefined // to manually control maximum page (when maxPage is undefined, maximum page limitation is not work)
});
</script>