JS/CSS判断是不是iphoneX?

js判断

  if (/iphone/gi.test(navigator.userAgent) && (screen.height == 812 && screen.width == 375)) {
           //是iphoneX
   } else {
          //不是iphoneX
   }

CSS判断:

@media only screen and (device-width: 375px) and (device-height: 812px) and (-webkit-device-pixel-ratio: 3) {
    .purchaseDiv, .closeBookList, .BottomProgress {
        bottom: 34px !important;
    }

}

你可能感兴趣的:(CSS,javascript)