@@ -4,27 +4,47 @@ To mask out the background when a dialog / modal or similar is opened, a overlay
44
55### [ See it in action] ( https://vue-comps.github.io/vue-overlay )
66
7- Only for [ ** webpack** ] ( https://webpack.github.io/ ) workflows.
8-
9-
107# Install
118
129``` sh
1310npm install --save-dev vue-overlay
1411```
12+ or include ` build/bundle.js `
1513
1614## Usage
1715``` coffee
18- overlay = require (" ../overlay.js" )(Vue) # overlay is a singleton
19-
20- zindex = overlay .open (options) # returns the z-index of the overlay + 1
16+ # overlay is a singleton and is designed
17+ # to be used in different places simultaniously
18+ overlay = require (" vue-overlay" )(Vue)
19+ # or, when using bundle.js
20+ overlay = window .vueComps .overlay
21+
22+ # returns the z-index of the overlay + 1 (starts with 1001)
23+ zindex = overlay .open (options)
24+ overlay .open () # z-index will raise by 5
25+
26+ # close hooks of the first options object will be called
27+ # and z-index will be lowered by 5
2128overlay .close ()
29+ overlay .close () # overlay really closes
30+
31+ # the overlay comes without animation, but you can easily set them up,
32+ # for example with velocity.js:
33+ Velocity = require (" velocity-animate" )
34+ overlay .fade = ({el,opacity,cb}) ->
35+ Velocity el, {opacity : opacity},
36+ {
37+ duration : 300
38+ queue : false
39+ easing : ' easeOutQuad'
40+ complete : cb
41+ }
2242```
2343#### Options
2444| Name | type | default | description |
2545| ---:| --- | ---| --- |
2646| opacity | Number | 0.5 | opacity of the overlay |
27- | dismissable | Boolean | true | Is the overlay dismissable by click or ESC? |
47+ | dismissable | Boolean | true | is the overlay dismissable by click or ESC? |
2848| onBeforeOpen | Function | null | hook before open animation |
2949| onOpened | Function | null | hook after open animation |
3050| onBeforeClose | Function | null | hook before close animation |
0 commit comments