Is there a simple way to check if a browser supports CSS Snap Points. I've set up a fail safe for a horizontal gallery but I'd like to turn off all the Javascript if the browser already natively supports snap points.

有没有一种简单的方法可以检查浏览器是否支持CSS Snap Points。我已经为水平图库设置了故障保护,但是如果浏览器本身支持快照点,我想关闭所有Javascript。

Also, are there any decent polyfills that might do a better job of what I've built here.

此外,是否有任何体面的polyfill可以更好地完成我在这里建立的。

1 个解决方案

#1


2

Try checking document.body style for "scroll-snap-type" property

尝试检查“scroll-snap-type”属性的document.body样式

  if ("scroll-snap-type" in document.body.style) {
    // do stuff with `scroll-snap-points`
  } else {
    // `scroll-snap-points` not supported
  }

更多相关文章

  1. jQuery Ui Draggable在移动端浏览器不起作用解决方案
  2. 目前最好用的“点击复制”功能,兼容主流浏览器
  3. ie8下jQuery动画没有ie7流畅,是浏览器性能问题吗?有没有什么解决方
  4. CSS样式如何解决IE浏览器不同版本的兼容问题
  5. 关于INPUT的autocomplete="off" 属性(浏览器表单默认的记忆功能)
  6. html 加上readonly后在各种浏览器的差异。
  7. html中显示div的时候,超出浏览器的宽,怎么解决,在线等!!!
  8. 我无法在某些Web浏览器中输入我的注册文本字段
  9. (转)让所有浏览器支持HTML5 video视频标签

随机推荐

  1. Android界面开发
  2. Android Handler机制4之Looper与Handler
  3. android Toast大全(五种情形)建立属于你自
  4. android 应用移植到ophone 平台需注意
  5. 设置TextView文字居中
  6. Android 音视频汇总
  7. Android内嵌H5(1)
  8. Android学习笔记(2)---android字体风格设置
  9. 关于linearLayout的中 android:layout_we
  10. Android中Activity启动模式详解