Detecting flex-wrap support in browsers

前端 未结 3 1872
花落未央
花落未央 2020-12-03 12:03

I am working on a project in which I have a responsive grid which I have achieved using flex wrap property. Since I am supporting IE9 and lower versions of Firefox, version

3条回答
  •  无人及你
    2020-12-03 12:32

    I found that this is the simplest method:

    var d = document.documentElement.style
    if (('flexWrap' in d) || ('WebkitFlexWrap' in d) || ('msFlexWrap' in d)){
      alert('ok');
    }
    

    I tried hasOwnProperty too but it doesn't work in IE and FF. So why use 40 KB of modernizr when you can have just 3 lines of js ?

提交回复
热议问题