Zepto fallback to jQuery

前端 未结 10 1665
孤独总比滥情好
孤独总比滥情好 2020-12-23 18:53

I\'m using ZeptoJS for my web app, but I\'d like to fall back to jQuery if the browser doesn\'t support Zepto. Since IE is the only major browser not supported at the moment

10条回答
  •  忘掉有多难
    2020-12-23 18:59

    Don't use the conditional comments, it's not going to be supported by IE10. This is the recommended approach from the zepto documentation:

    Load Zepto on modern browser and jQuery on IE

    
    

    Zepto doesn't work in IE because IE doesn't support prototype, so this is exactly the right way to check.

    The script above do a dynamical load but the logic is

    
    

提交回复
热议问题