├── css ├── _mixins.scss ├── style.scss ├── _reset.scss └── style.css ├── .gitignore ├── js └── main.js └── index.html /css/_mixins.scss: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | .sass-cache/ 3 | 4 | -------------------------------------------------------------------------------- /js/main.js: -------------------------------------------------------------------------------- 1 | $(document).ready(function() { 2 | 3 | $('#minmax_button').bind('click', one); 4 | $('#minmax_button').bind('click', two); 5 | $('#minmax_button').click(function() { 6 | $('#editor_wrapper').toggleClass('minimize'); 7 | $(this).unbind('click', two); 8 | 9 | }); 10 | 11 | 12 | $("#editor_wrapper").draggable(); 13 | 14 | $("#editor_wrapper").on('dragstop', function(event) { 15 | console.log('top ' + $(this).css('top')); 16 | console.log('left' + $(this).css('left')); 17 | event.preventDefault(); 18 | }) 19 | }); 20 | 21 | function one() { 22 | alert('one'); 23 | } 24 | 25 | function two() { 26 | alert('two'); 27 | } -------------------------------------------------------------------------------- /index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | CSS On the go editor 4 | 5 | 6 | 7 | 8 | 9 |
10 |
11 | 22 |
23 | _ 24 |
25 | 26 |
27 | 28 | -------------------------------------------------------------------------------- /css/style.scss: -------------------------------------------------------------------------------- 1 | @import 'reset'; 2 | @import 'mixins'; 3 | 4 | style[contenteditable] { 5 | display: block; 6 | background: blue; 7 | color: white; 8 | height: 100%; 9 | white-space: pre; 10 | } 11 | 12 | #editor_wrapper { 13 | position: absolute; 14 | width: 500px; 15 | height: 400px; 16 | box-sizing: border-box; 17 | -webkit-transition: all .5s linear; 18 | 19 | #editor { 20 | position: absolute; 21 | top: 0; 22 | bottom: 0; 23 | left: 0; 24 | right: 0; 25 | background: tomato; 26 | } 27 | 28 | #minmax_button { 29 | display: inline-block; 30 | position: absolute; 31 | width: 20px; 32 | height: 20px; 33 | right: 0; 34 | background: lightgreen; 35 | } 36 | } 37 | 38 | .minimize { 39 | width: 20px !important; 40 | height: 20px !important; 41 | border-radius: 10px; 42 | overflow: hidden; 43 | } 44 | 45 | -------------------------------------------------------------------------------- /css/_reset.scss: -------------------------------------------------------------------------------- 1 | /* http://meyerweb.com/eric/tools/css/reset/ 2 | v2.0 | 20110126 3 | License: none (public domain) 4 | */ 5 | 6 | html, body, div, span, applet, object, iframe, 7 | h1, h2, h3, h4, h5, h6, p, blockquote, pre, 8 | a, abbr, acronym, address, big, cite, code, 9 | del, dfn, em, img, ins, kbd, q, s, samp, 10 | small, strike, strong, sub, sup, tt, var, 11 | b, u, i, center, 12 | dl, dt, dd, ol, ul, li, 13 | fieldset, form, label, legend, 14 | table, caption, tbody, tfoot, thead, tr, th, td, 15 | article, aside, canvas, details, embed, 16 | figure, figcaption, footer, header, hgroup, 17 | menu, nav, output, ruby, section, summary, 18 | time, mark, audio, video { 19 | margin: 0; 20 | padding: 0; 21 | border: 0; 22 | font-size: 100%; 23 | font: inherit; 24 | vertical-align: baseline; 25 | } 26 | /* HTML5 display-role reset for older browsers */ 27 | article, aside, details, figcaption, figure, 28 | footer, header, hgroup, menu, nav, section { 29 | display: block; 30 | } 31 | body { 32 | line-height: 1; 33 | } 34 | ol, ul { 35 | list-style: none; 36 | } 37 | blockquote, q { 38 | quotes: none; 39 | } 40 | blockquote:before, blockquote:after, 41 | q:before, q:after { 42 | content: ''; 43 | content: none; 44 | } 45 | table { 46 | border-collapse: collapse; 47 | border-spacing: 0; 48 | } -------------------------------------------------------------------------------- /css/style.css: -------------------------------------------------------------------------------- 1 | /* http://meyerweb.com/eric/tools/css/reset/ 2 | v2.0 | 20110126 3 | License: none (public domain) 4 | */ 5 | html, body, div, span, applet, object, iframe, 6 | h1, h2, h3, h4, h5, h6, p, blockquote, pre, 7 | a, abbr, acronym, address, big, cite, code, 8 | del, dfn, em, img, ins, kbd, q, s, samp, 9 | small, strike, strong, sub, sup, tt, var, 10 | b, u, i, center, 11 | dl, dt, dd, ol, ul, li, 12 | fieldset, form, label, legend, 13 | table, caption, tbody, tfoot, thead, tr, th, td, 14 | article, aside, canvas, details, embed, 15 | figure, figcaption, footer, header, hgroup, 16 | menu, nav, output, ruby, section, summary, 17 | time, mark, audio, video { 18 | margin: 0; 19 | padding: 0; 20 | border: 0; 21 | font-size: 100%; 22 | font: inherit; 23 | vertical-align: baseline; } 24 | 25 | /* HTML5 display-role reset for older browsers */ 26 | article, aside, details, figcaption, figure, 27 | footer, header, hgroup, menu, nav, section { 28 | display: block; } 29 | 30 | body { 31 | line-height: 1; } 32 | 33 | ol, ul { 34 | list-style: none; } 35 | 36 | blockquote, q { 37 | quotes: none; } 38 | 39 | blockquote:before, blockquote:after, 40 | q:before, q:after { 41 | content: ''; 42 | content: none; } 43 | 44 | table { 45 | border-collapse: collapse; 46 | border-spacing: 0; } 47 | 48 | style[contenteditable] { 49 | display: block; 50 | background: blue; 51 | color: white; 52 | height: 100%; 53 | white-space: pre; } 54 | 55 | #editor_wrapper { 56 | position: absolute; 57 | width: 500px; 58 | height: 400px; 59 | box-sizing: border-box; 60 | -webkit-transition: all .5s linear; } 61 | #editor_wrapper #editor { 62 | position: absolute; 63 | top: 0; 64 | bottom: 0; 65 | left: 0; 66 | right: 0; 67 | background: tomato; } 68 | #editor_wrapper #minmax_button { 69 | display: inline-block; 70 | position: absolute; 71 | width: 20px; 72 | height: 20px; 73 | right: 0; 74 | background: lightgreen; } 75 | 76 | .minimize { 77 | width: 20px !important; 78 | height: 20px !important; 79 | border-radius: 10px; 80 | overflow: hidden; } 81 | 82 | /*# sourceMappingURL=style.css.map */ 83 | --------------------------------------------------------------------------------