Zepto fallback to jQuery

前端 未结 10 1663
孤独总比滥情好
孤独总比滥情好 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 19:21

    You can also use JS trick described here to detect whether browser is IE, and use a modern asynchronous script loading library to load the required lib. Yepnope example:

    yepnope({
      test: !+"\v1", // IE?
      yep: 'jquery.js',
      nope: 'zepto.js'
    });
    

提交回复
热议问题