How to load or not a JS script (into the head section) based on screen resolution?

前端 未结 6 1376
眼角桃花
眼角桃花 2020-12-20 02:36

on a website, I have these lines on the tag

  
  

        
6条回答
  •  天涯浪人
    2020-12-20 03:16

    Replace your script tags with this script tag, which will create the other three script tags ONLY of the window width is larger than a certain amount.

    This answer does not rely on jQuery, so you can use it to determine whether you want to load jQuery.

    
    

提交回复
热议问题