jQuery Mousewheel每次加载并减慢我的网站速度

时间:2018-01-05 18:53:17

标签: javascript jquery

我的网站最近变得很慢。

检查“网络”选项卡后,似乎每次都会下载jQuery.mousewheel。

最终看起来像这样:

https://cdnjs.cloudflare.com/ajax/libs/jquery-mousewheel/3.1.13/jquery.mousewheel.min.js?_=1515178223914

每一次都有一个随机数字。

我能以任何方式阻止这种情况吗?老实说,我甚至不知道它来自何处。我显然使用的是jQuery,但下载一次后它应该保留在缓存中。

提前致谢。

2 个答案:

答案 0 :(得分:0)

尝试下载脚本并将其连接到本地项目,最后没有数字。这个数字需要您浏览器不要缓存此脚本

答案 1 :(得分:0)

我注释掉了加载它的jQuery部分(else语句):

(function(init){
    var _rjs=typeof define==="function" && define.amd, /* RequireJS */
        _njs=typeof module !== "undefined" && module.exports, /* NodeJS */
        _dlp=("https:"==document.location.protocol) ? "https:" : "http:", /* location protocol */
        _url="cdnjs.cloudflare.com/ajax/libs/jquery-mousewheel/3.1.13/jquery.mousewheel.min.js";
    if(!_rjs){
        if(_njs){
            require("jquery-mousewheel")($);
        }else{
            /* load jquery-mousewheel plugin (via CDN) if it's not present or not loaded via RequireJS
             (works when mCustomScrollbar fn is called on window load) */
      /*      $.event.special.mousewheel || $("head").append(decodeURI("%3Cscript src="+_dlp+"//"+_url+"%3E%3C/script%3E"));*/
        }
    }
    init();
}

出于某种原因它虽然从未加载过。

相关问题