Code Monkey home page Code Monkey logo

vue-offcanvas's Introduction

vue-offcanvas

A simple offcanvas sidebar for Vue.js (compatible with Vue 2.x)

Links

It's built as UMD module, so you can use it in any way you want.

Directly in an HTML page (it will be available as global variables VueOffcanvas):

<script type="text/javascript" src="http://cdn.rawgit.com/sunabozu/vue-offcanvas/master/index.js"></script>

Or by installing...

npm i vue-offcanvas --save

...and then importing it:

import VueOffcanvas from 'vue-offcanvas'

// or

const VueOffcanvas = require('vue-offcanvas')

Usage

In your component:

export default {
  data() {
    return {
      show: false
    }
  },

  components: {
    VueOffcanvas,
  },

  ...
}

In your template:

<button @click="show = true">Toggle</button>

<vue-offcanvas v-model="show" :width="300" :duration=".3" effect="ease-in-out">
  the content of your sidebar goes here
</vue-offcanvas>

WARNING: do not use the style attribute on the root element (vue-offcanvas in this case). Use css classes instead.

Properties

Property Default Description
align left Position of the sidebar (left or right)
width 270 Width of the sidebar
duration 0.2 Duration of the slide-in/slide-out animation
effect linear A timing function for the transition-timing-function css property; you can also use the custom bounce value
close-on-external-click true Should the sidebar be closed on a click outside it?
close-on-esc true Should the sidebar be closed on an Esc key?

vue-offcanvas's People

Contributors

sunabozu avatar vahidalvandi avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

vue-offcanvas's Issues

the side bar not showing content

Hi, i was looking for something like this, great job and easy integration, there is a problem, and the same problem is present in your demo, first the content inside of sidebar is not showing, and in the console it throw an error: Error in render: "ReferenceError: _h is not defined", hope you can keep going doing this great plugin, thanks.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.