H5Snap

功能描述

H5Snap是滑动菜单的原生js实现,无任何依赖。

依赖插件

快速使用

var snapper = new Snap({
    element: document.getElementById('content')
});
snapper.open('left') // 打开左侧区域

配置项

element

  • 类型:HTMLElement
  • 默认值:null
  • 作用:内容区
  • 是否必传:是

disable

  • 类型:String
  • 取值:left|right
  • 默认值:none
  • 作用:禁用左右滑动区域
  • 是否必传:否

easing

  • 类型:String
  • 取值:linear|ease|ease-in|ease-out|ease-in-out
  • 默认值:ease
  • 作用:open侧滑切换动画
  • 是否必传:否

maxPosition

  • 类型:Number
  • 默认值:266
  • 作用:滑向右边的最大距离
  • 是否必传:否

minPosition

  • 类型:Number
  • 默认值:-266
  • 作用:滑向左边的最大距离
  • 是否必传:否

tapToClose

  • 类型:Boolean
  • 默认值:true
  • 作用:点击关闭
  • 是否必传:否

方法

打开

snapper.open('left|right')

关闭

snapper.close()

特别说明

更多配置和用法,请参考Snap.js

是否仍需要帮助? 请保持联络!
最后更新于 2024/07/22