1

I'm using turn.js on my sales page here (http://www.breakintobartending.com/highball/) and I'd like to know how to prevent the flipbook from making .json file requests for each page. I don't have any clickable items anywhere in the book, but the code is still making requests for these .json files (which slows down the load time a bit).

What bit of code do I remove (or add?) to prevent the page from requesting these files.

4

2 回答 2

2

在您的文件“Magazine.js”中,您在第 76 行有以下代码

function loadRegions(page, element) {
  $.getJSON(grerda_basePath+'pages/'+page+'-regions.json').
  done(function(data) {
     $.each(data, function(key, region) {
       addRegion(region, element);
     });
  });
}

我认为您可以删除或评论它以查看它的作用。

我花了大约 30 秒才找到这个 ajax 调用。要找到它,我只需打开 firefox + firebug,并在您的代码中搜索字符串“.json”。

您可以添加断点,并查看控制台以检查您所做的事情

于 2013-09-11T07:51:01.807 回答
0

此外,您可以从“pages”子文件夹中删除任何“x-regions.json”文件。(其中 x 是页码...)这当然假设“magazine.js”是智能的并缓存此数据,因此在以下页面交互时它不会重新请求不存在的内容。对于只有几页的小型杂志,这应该无关紧要,因为请求的数量是微不足道的。

在“magazine.js”中注释掉对“loadRegions”的调用是一个不错的选择。

于 2018-05-25T14:56:00.230 回答