Skip to content

Commit

Permalink
FIX: add simple-stack-fullscreen class if el is data-stack-fullscreen…
Browse files Browse the repository at this point in the history
… when init
  • Loading branch information
yxwyoyoyo committed Dec 13, 2019
1 parent aad8fca commit ae1bb18
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 3 deletions.
9 changes: 8 additions & 1 deletion lib/stack.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ Stack = (function(superClass) {
title: '{{ name }}',
transition: true,
slowTime: 800,
fluid: false
fluid: false,
fullscreen: false
};

Stack.prototype.supportHistory = !!(window.history && history.pushState);
Expand All @@ -47,10 +48,16 @@ Stack = (function(superClass) {
if (this.el.is('[data-stack-fluid]')) {
this.opts.fluid = true;
}
if (this.el.is('[data-stack-fullscreen]')) {
this.opts.fullscreen = true;
}
this.el.addClass('simple-stack');
if (this.opts.fluid) {
this.el.addClass('simple-stack-fluid');
}
if (this.opts.fullscreen) {
this.el.addClass('simple-stack-fullscreen');
}
this.stack = [];
this._initStack();
this.currentPage.loadPage();
Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "simple-stack",
"version": "2.0.8",
"version": "2.0.9",
"description": "A stack layout component",
"main": "lib/stack.js",
"repository": {
Expand Down
3 changes: 3 additions & 0 deletions src/stack.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ class Stack extends SimpleModule
transition: true
slowTime: 800
fluid: false
fullscreen: false

supportHistory: !!(window.history && history.pushState)

Expand All @@ -17,9 +18,11 @@ class Stack extends SimpleModule
return unless @el.length > 0

@opts.fluid = true if @el.is '[data-stack-fluid]'
@opts.fullscreen = true if @el.is '[data-stack-fullscreen]'

@el.addClass 'simple-stack'
@el.addClass 'simple-stack-fluid' if @opts.fluid
@el.addClass 'simple-stack-fullscreen' if @opts.fullscreen

@stack = []
@_initStack()
Expand Down

0 comments on commit ae1bb18

Please sign in to comment.