bootstrap-sidebar

A responsive sidebar plugin for bootstrap 3. if your menus are too big to fit into a horizontal menubar, or you need to have a responsive sidebar that is compatible with bootstrap, then this is the plugin for you.

  • 所有者: asyraf9/bootstrap-sidebar
  • 平台:
  • 许可证:
  • 分类:
  • 主题:
  • 喜欢:
    0
      比较:

Github星跟踪图

###Changelog:
v0.2.0:

  1. CSS overrides to allow unresponsive top navbar menu items with the 'navbar-static' class (refer index.html)
  2. Renamed 'sidebar-show-{{size}}' to 'sidebar-{{size}}-show' for consistency with column classes

v0.1.0:

  1. Right sidebar now fully tested. make sure your right sidebar is after your 'main' content in your HTML if you want to make it a permanent sidebar at any screen size.
  2. Clicking anywhere outside of the sidebar hides the sidebar (if it is not set to permanent) see index.html
  3. Sidebars are now hidden by default, and you can make it display permanently by adding a sidebar-{{size}}-show class (replace size with xs, sm, md, lg as per Bootstrap's convention) see index.html. Make sure your 'main' content area are classed properly with 'col-{{size}}-#' and 'col-{{size}}-offset-#' so that the main content is displayed properly when the sidebar is permanently open.

bootstrap-sidebar

A responsive sidebar plugin for bootstrap 3. if your menus are too big to fit into a horizontal menubar, or you need to have a responsive sidebar that is compatible with bootstrap, then this is the plugin for you.
(NOTE: Contributions are welcome! please issue a Pull Request)

###Features:

  1. Hardware accelerated slide-in animation
  2. You can set the sidebar to be permanently open for any screen size
  3. You can set the sidebar size for each screen size using standard bootstrap grid classes
  4. Clicking outside of the sidebars closes it automatically (if the sidebar is not open permanently)
  5. Right and Left sidebars now work.
  6. CSS overrides for top navbar to allow menu items to stay visible and not responsive when in smaller screens

###Current Limitations:

  1. This sidebar assumes you have a fixed top menubar
  2. This sidebar assumes you are using the 'container-fluid' class. use the affix plugin or a normal vertical menu for a fixed-width setup.
  3. you will have to write some custom css to enable fixed horizontal menu items (ask me if you need help)
  4. This plugin is only tested for the left sidebar only. support for setting up a right sidebar exists but has never been tested yet.
  5. Clicking outside the sidebar does not close the sidebar in smaller screens.
  6. On larger screens the sidebar is open(visible) by default and there is no way to change this at the moment.

###Demo:

view plunker demo here: http://run.plnkr.co/plunks/sA6H7U/

#####OR

open index.html on your browser to checkout the features

###Installation:

Install using bower:

bower install bootstrap-sidebar

or download a zip copy of this repo

###Usage:

Usage is almost the same as the horizontal menubar collapse method: define a button on your top menubar that toggles the sidebar on and off like this:

<button type="button" class="navbar-toggle" data-toggle="sidebar" data-target=".sidebar">
  <span class="sr-only">Toggle navigation</span>
  <span class="icon-bar"></span>
  <span class="icon-bar"></span>
  <span class="icon-bar"></span>
</button>

Note the data-toggle and data-target attriubutes - these are the attributes necessary to make this button work with sidebar

then define your sidebar column as:

<div class="col-xs-7 col-sm-3 col-md-2 sidebar sidebar-left sidebar-animate">
  <!-- content -->
</div>

#####Note the important classes:

  • "sidebar" - main css class
  • "sidebar-left" - to define the position of your sidebar and slide-in slide-out animations. Options are: sidebar-left, sidebar-right
  • "sidebar-animation" - (Optional) to tell sidebar to animate sliding in and out.
  • "col-xs-7", "col-sm-3", "col-md-2" - you can freely set the sidebar column sizes across different screen sizes according to Bootstrap's Grid guidelines

###Defining permanent sidebars:

To define a sidebar that displays permanently for a certain screen size (in this example, for sizes md and above):

<div class="col-xs-7 col-sm-3 col-md-3 sidebar sidebar-left sidebar-animate sidebar-md-show">
  <!-- Sidebar content here! -->
</div>

make sure your main content area is defined as follows:

<div class="col-md-9 col-md-offset-3">
  <!-- Main Content here! -->
</div>

#####Note the important classes:

  1. In the sidebar div:
  • "sidebar-md-show" - tells the sidebar to be permanently open. 'md' refers to the screen size you want the sidebar to be permanently open at (options are: xs, sm, md, lg as per bootstrap 3 conventions). make sure you set your column sizes accordingly to accomodate a permanent sidebar.
  1. In the main content div:
  • "col-md-9" - sets the column size of the main content. this column size must take into consideration the column size of the sidebar at the corresponding screen size (they must total 12)
  • "col-md-offset-3" - offsets the main content according to the column size of the sidebar. otherwise your content will be hidden by the sidebar. the value here must equal the column value of the sidebar

主要指标

概览
名称与所有者asyraf9/bootstrap-sidebar
主编程语言CSS
编程语言CSS (语言数: 2)
平台
许可证
所有者活动
创建于2014-05-14 01:18:24
推送于2017-04-17 03:32:04
最后一次提交2014-12-30 09:19:23
发布数3
最新版本名称v0.2.2 (发布于 )
第一版名称v0.2.0 (发布于 )
用户参与
星数277
关注者数33
派生数73
提交数37
已启用问题?
问题数10
打开的问题数9
拉请求数4
打开的拉请求数2
关闭的拉请求数1
项目设置
已启用Wiki?
已存档?
是复刻?
已锁定?
是镜像?
是私有?