Yepnope & Modernizr screen.width Conditions

别来无恙 提交于 2019-12-04 14:27:41

yep: '/css/smartdevice.css','/js/smartdevice.js', is illegal JS. If you want this to be an array, use yep: ['/css/smartdevice.css','/js/smartdevice.js'],. Anytime you see a comma inside a JavaScript object, pretend there's a newline, and you'll see what's going wrong here:

Modernizr.load([
{
    test: Modernizr.mq('all and (max-width: 1070px)'), // prop:val(=function)
    yep: '/css/smartdevice.css',                       // prop:val(=string)
    '/js/smartdevice.js',                              // ???
}
,...
Frank Krul

Some suggestions:

  1. Replace "all" with the label "only all"
  2. Replace the "max-width: 1070px" in the first test with a mobile device width (320 etc)
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!