使用无限滚动JavaScript库处理项目。我正在尝试使用我下载的 gif 作为无限滚动库对服务器的 ajax 调用时的加载图像。
但是,无论我如何进行图像路由,它都不会抓取我下载的加载 gif。非常令人沮丧,因为错误看起来像"GET http://localhost:3000/app/assets/images/myblend-loading.gif 404(未找到)",这正是我托管图像的地方(尽管我没有通往它的路由)。
有谁知道如何在这个库中使用本地托管的 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
您也可以将其放在公共文件夹中,然后执行
/myblend-loading.gif