├── LICENSE
├── README.md
├── css
├── avgrund.css
└── demo.css
├── index.html
├── js
└── avgrund.js
└── multiple.html
/LICENSE:
--------------------------------------------------------------------------------
1 | Copyright (C) 2017 Hakim El Hattab, http://hakim.se
2 |
3 | Permission is hereby granted, free of charge, to any person obtaining a copy
4 | of this software and associated documentation files (the "Software"), to deal
5 | in the Software without restriction, including without limitation the rights
6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7 | copies of the Software, and to permit persons to whom the Software is
8 | furnished to do so, subject to the following conditions:
9 |
10 | The above copyright notice and this permission notice shall be included in
11 | all copies or substantial portions of the Software.
12 |
13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19 | THE SOFTWARE.
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Avgrund
2 |
3 | A modal concept which aims to give a sense of depth between the page and modal layers.
4 |
5 | [Check out the demo page](http://lab.hakim.se/avgrund/).
6 |
7 | ## License
8 |
9 | MIT licensed
10 |
11 | Copyright (C) 2018 Hakim El Hattab, http://hakim.se
12 |
--------------------------------------------------------------------------------
/css/avgrund.css:
--------------------------------------------------------------------------------
1 | /*!
2 | * avgrund 0.1
3 | * http://lab.hakim.se/avgrund
4 | * MIT licensed
5 | *
6 | * Created by Hakim El Hattab, http://hakim.se
7 | */
8 |
9 | body {
10 | display: flex;
11 | }
12 |
13 | .avgrund-active body {
14 | transform: scale( 0.9 );
15 | }
16 |
17 | .avgrund-cover {
18 | position: fixed;
19 | width: 100%;
20 | height: 100%;
21 | top: 0;
22 | left: 0;
23 | z-index: 1;
24 | visibility: hidden;
25 | opacity: 0;
26 | background: rgba( 0, 0, 0, 0.5 );
27 | }
28 | .avgrund-active .avgrund-cover {
29 | visibility: visible;
30 | opacity: 1;
31 | }
32 |
33 | .avgrund-contents {
34 | position: relative;
35 | padding: 20px;
36 | max-width: 400px;
37 | margin: auto;
38 | }
39 | .avgrund-active .avgrund-contents {
40 | -webkit-filter: blur(2px);
41 | -moz-filter: blur(2px);
42 | -ms-filter: blur(2px);
43 | filter: blur(2px);
44 | }
45 | .no-blur.avgrund-active .avgrund-contents {
46 | -webkit-filter: none;
47 | -moz-filter: none;
48 | -ms-filter: none;
49 | filter: none;
50 | }
51 |
52 | .avgrund-popup {
53 | position: absolute;
54 | width: 440px;
55 | left: 50%;
56 | top: 50%;
57 | margin: -140px 0 0 -220px;
58 | visibility: hidden;
59 | opacity: 0;
60 | z-index: 2;
61 | padding: 30px;
62 |
63 | background: white;
64 | box-shadow: 0px 0px 60px rgba( 0, 0, 0, 0.3 );
65 | border-radius: 3px;
66 | box-sizing: border-box;
67 |
68 | transform: scale( 0.8 );
69 | }
70 | .avgrund-active .avgrund-popup-animate {
71 | visibility: visible;
72 | opacity: 1;
73 |
74 | transform: scale( 1.1111 );
75 | }
76 | .avgrund-popup.stack {
77 | transform: scale( 1.5 );
78 | }
79 | .avgrund-active .avgrund-popup.stack {
80 | transform: scale( 1.1111 );
81 | }
82 |
83 |
84 | .avgrund-ready body,
85 | .avgrund-ready .avgrund-contents,
86 | .avgrund-ready .avgrund-popup,
87 | .avgrund-ready .avgrund-cover {
88 | transform-origin: 50% 50%;
89 | transition: 0.3s all cubic-bezier(0.250, 0.460, 0.450, 0.940);
90 | }
91 | .avgrund-ready .avgrund-popup.no-transition {
92 | transition: none;
93 | }
94 |
95 |
--------------------------------------------------------------------------------
/css/demo.css:
--------------------------------------------------------------------------------
1 | /*!
2 | * Styles intended only for this demo page. If you want to
3 | * try and use Avgrund in your project, don't include these.
4 | */
5 |
6 | * {
7 | margin: 0;
8 | padding: 0;
9 | }
10 |
11 | html,
12 | body {
13 | height: 100%;
14 | overflow: hidden;
15 | }
16 |
17 | html {
18 | background-color: #222;
19 | background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAQAAAAECAYAAACp8Z5+AAAAGklEQVQIW2NkYGD4D8SMQAwGcAY2AbBKDBUAVuYCBQPd34sAAAAASUVORK5CYII=);
20 | background-repeat: repeat;
21 | }
22 |
23 | h1,
24 | h2 {
25 | font-size: 24px;
26 | }
27 |
28 | p {
29 | margin: 20px 0 20px 0;
30 | font-size: 18px;
31 | line-height: 1.4;
32 | }
33 |
34 | a {
35 | color: #2faeff;
36 | text-decoration: none;
37 |
38 | -webkit-transition: 0.15s color ease;
39 | -moz-transition: 0.15s color ease;
40 | -ms-transition: 0.15s color ease;
41 | -o-transition: 0.15s color ease;
42 | transition: 0.15s color ease;
43 | }
44 | a:hover {
45 | color: #68c4ff;
46 | }
47 |
48 | small {
49 | display: block;
50 | margin-top: 25px;
51 | padding-top: 25px;
52 | color: #333;
53 | font-size: 16px;
54 | line-height: 1.4;
55 | border-top: 1px solid #ddd;
56 |
57 | -webkit-text-size-adjust: none;
58 | }
59 |
60 | button {
61 | border: 0px;
62 | padding: 10px 14px;
63 | margin: 5px 0px;
64 | border-radius: 2px;
65 |
66 | cursor: pointer;
67 | color: #fff;
68 | background: #2faeff;
69 | font-size: 18px;
70 |
71 | outline: none;
72 |
73 | -webkit-transition: 0.15s background ease;
74 | -moz-transition: 0.15s background ease;
75 | -ms-transition: 0.15s background ease;
76 | -o-transition: 0.15s background ease;
77 | transition: 0.15s background ease;
78 | }
79 | button:hover {
80 | background: #68c4ff;
81 | }
82 | button:active {
83 | background: #18a5ff;
84 | }
85 | button+button {
86 | margin-left: 5px;
87 | }
88 |
89 | .sharing {
90 | margin-top: 50px;
91 | }
92 |
93 | body {
94 | background: #fff;
95 |
96 | font-family: 'Lato', Helvetica, sans-serif;
97 | font-size: 16px;
98 | color: #222;
99 | }
--------------------------------------------------------------------------------
/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | Avgrund - A modal UI concept
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
27 |
28 |
29 |
30 |
31 |
32 |
42 |
43 |
44 | Avgrund
45 |
46 | A modal concept which aims to give a sense of depth between the page and modal layers. Click the button below to give it a try.
47 |
48 |
49 |
50 | Uses CSS transforms to scale components and CSS filters to blur the page. Built for the fun of
51 | it, not intended for any practical use.
52 |
53 |
54 | Avgrund is Swedish for abyss.
55 |
56 |
57 | Created by Hakim El Hattab
58 | @hakimel — http://hakim.se
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
--------------------------------------------------------------------------------
/js/avgrund.js:
--------------------------------------------------------------------------------
1 | /*!
2 | * avgrund 0.1
3 | * http://lab.hakim.se/avgrund
4 | * MIT licensed
5 | *
6 | * Copyright (C) 2018 Hakim El Hattab, http://hakim.se
7 | */
8 | var Avgrund = (function(){
9 |
10 | var container = document.documentElement,
11 | popup = document.querySelector( '.avgrund-popup-animate' ),
12 | cover = document.querySelector( '.avgrund-cover' ),
13 | currentState = null;
14 |
15 | container.classList.add( 'avgrund-ready' );
16 |
17 | // Deactivate on ESC
18 | function onDocumentKeyUp( event ) {
19 |
20 | if( event.keyCode === 27 ) {
21 | deactivate();
22 | }
23 |
24 | }
25 |
26 | // Deactivate on click outside
27 | function onDocumentClick( event ) {
28 |
29 | if( event.target === cover ) {
30 | deactivate();
31 | }
32 |
33 | }
34 |
35 | function activate( state ) {
36 |
37 | document.addEventListener( 'keyup', onDocumentKeyUp, false );
38 | document.addEventListener( 'click', onDocumentClick, false );
39 | document.addEventListener( 'touchstart', onDocumentClick, false );
40 |
41 | popup.classList.remove( currentState );
42 | popup.classList.add( 'no-transition' );
43 | if(state)
44 | popup.classList.add( state );
45 |
46 | setTimeout( function() {
47 | popup.classList.remove( 'no-transition' );
48 | container.classList.add( 'avgrund-active' );
49 | }, 0 );
50 |
51 | currentState = state;
52 |
53 | }
54 |
55 | function deactivate() {
56 |
57 | document.removeEventListener( 'keyup', onDocumentKeyUp, false );
58 | document.removeEventListener( 'click', onDocumentClick, false );
59 | document.removeEventListener( 'touchstart', onDocumentClick, false );
60 |
61 | container.classList.remove( 'avgrund-active' );
62 | popup.classList.remove( 'avgrund-popup-animate' );
63 |
64 | }
65 |
66 | function disableBlur() {
67 |
68 | document.documentElement.classList.add( 'no-blur' );
69 |
70 | }
71 |
72 | function show( selector ) {
73 |
74 | popup = document.querySelector( selector );
75 | popup.classList.add( 'avgrund-popup-animate' );
76 | activate();
77 | return this;
78 |
79 | }
80 |
81 | function hide() {
82 |
83 | deactivate();
84 |
85 | }
86 |
87 | return {
88 |
89 | activate: activate,
90 | deactivate: deactivate,
91 | disableBlur: disableBlur,
92 | show: show,
93 | hide: hide
94 |
95 | }
96 |
97 | })();
98 |
--------------------------------------------------------------------------------
/multiple.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | Avgrund - A modal UI concept
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
30 |
31 |
32 |
33 |
34 |
35 |
45 |
46 |
53 |
54 |
55 | Avgrund
56 |
57 | A modal concept which aims to give a sense of depth between the page and modal layers. Click the button below to give it a try.
58 |
59 |
60 |
61 |
62 | Uses CSS transforms to scale components and CSS filters to blur the page. Built for the fun of
63 | it, not intended for any practical use.
64 |
65 |
66 | Avgrund is Swedish for abyss.
67 |
68 |
69 | Created by @hakimel / http://hakim.se
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
--------------------------------------------------------------------------------