load jquery after the page is fully loaded

前端 未结 11 1417
甜味超标
甜味超标 2020-12-31 08:32

I\'m looking for a way to load jquery after the page is fully loaded.
well there are lots of questions and answers about it in here, but all describe how to run a scri

11条回答
  •  挽巷
    挽巷 (楼主)
    2020-12-31 08:44

    For your problem, the solution might be to attach CDN hosted by google with certain library:

    https://developers.google.com/speed/libraries/devguide

    Also, you can add this at the bottom of page (just before ):

    
    

    However, this is risky in my opinion. You have an asynchronous call for jquery, thus your jquery has to wait until it loads (ie. $(document).ready won't work in this case). So my answer would be: use a CDN like google suggests; put your javascript on the bottom just before ; and, ignore flags from profilers.

提交回复
热议问题