无限滚动js:本地托管加载gif

Infinite scroll js: locally hosted loading gif

正在使用 infinite scroll javascript 库处理一个项目。当无限滚动库对服务器进行 ajax 调用时,我正在尝试使用我下载的 gif 作为加载图像。

但是无论我如何进行图像路由,它都不会抓取我下载的正在加载的 gif。非常令人沮丧,因为错误看起来像这样 "GET http://localhost:3000/app/assets/images/myblend-loading.gif 404 (Not Found)" 这正是我托管图像的地方(尽管我没有通往它的路线)。

有谁知道如何将本地托管的 gif 与此库一起使用?

$container.infinitescroll({
  navSelector: 'nav.pagination', // selector for the paged navigation
  nextSelector: 'nav.pagination a[rel=next]', // selector for the NEXT link (to page 2)
  itemSelector: '#discover_content div.discover-article', // selector for all items you'll retrieve
  bufferPx: Math.round($(window).height() * 1.5),
  pixelsFromNavToBottom: Math.round($(window).height() * 1.5),
  loading: {
    finishedMsg: 'No more products to load.',
    msgText: "",
    img: "/app/assets/images/myblend-loading.gif" #this should be where the image is hosted
  }
}

尝试

/assets/myblend-loading.gif

你也可以把它放在public文件夹里然后就可以了

/myblend-loading.gif