js带模糊效果的隐藏滑动侧边栏插件

js带模糊效果的隐藏滑动侧边栏插件

pushbar.js是一款带模糊效果的js隐藏滑动侧边栏插件。pushbar.js能制作上下左右四个方向的滑动侧边栏效果,并且在侧边栏菜单显示的时候,主页面会带有炫酷的模糊特效。

使用方法

在页面中引入pushbar.js和pushbar.css文件。

<link href="dist/css/pushbar.css" rel="stylesheet">
<script src="js/pushbar.js"></script>

HTML结构

该js隐藏滑动侧边栏菜单的HTML结构如下:

<div data-pushbar-id="mypushbar1" class="pushbar from_left">
      Push bar content 1
      <button data-pushbar-close>Close</button>
  </div>
  <div data-pushbar-id="mypushbar2" class="pushbar from_bottom">
      Push bar content 2
      <button data-pushbar-close>Close</button>
  </div>
  <div class="pushbar_main_content">
      Main content of the page
      <button data-pushbar-target="mypushbar1">
      Open my pushbar 1
      </button>
      <button data-pushbar-target="mypushbar2">
      Open my pushbar 2
      </button>
  </div>

初始化插件

在页面DOM元素加载完毕之后,通过下面的方法来初始化pushbar.js插件。

var pushbar = new Pushbar({
    blur:true,
    overlay:true,
});

配置参数

该js隐藏滑动侧边栏菜单的可用配置参数如下:

  • blur:是否在打开侧边栏时主页面带模糊效果。

  • overlay:是否在打开侧边栏时主页面带遮罩层。


无法在这个位置找到: AD-M-710-200.htm
相关插件
无法在这个位置找到: AD-M-ar-1.htm