summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormarkop <marko.pusnik@gurucue.com>2015-07-17 12:45:48 +0200
committermarkop <marko.pusnik@gurucue.com>2015-07-17 12:45:48 +0200
commitcfb1832029679eeaa644eae719688073a36c650e (patch)
tree3b6cc71905e0d3d6702bf06a7810befdc80b78b1
parent914d4397eec93dd35030bbdc5ea88239c7b37a9e (diff)
resizable experiment
-rw-r--r--resizable.html318
1 files changed, 318 insertions, 0 deletions
diff --git a/resizable.html b/resizable.html
new file mode 100644
index 0000000..6f32028
--- /dev/null
+++ b/resizable.html
@@ -0,0 +1,318 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+ <meta charset="utf-8">
+ <meta http-equiv="X-UA-Compatible" content="IE=edge">
+ <meta name="viewport" content="width=device-width, initial-scale=1">
+ <!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags -->
+ <title>Bootstrap 101 Template</title>
+
+ <!-- Bootstrap -->
+ <link href="css/bootstrap.min.css" rel="stylesheet">
+ <link href="css/bootstrap-theme.min.css" rel="stylesheet">
+ <!-- jQuery UI -->
+ <link href="css/jquery/jquery-ui.min.css" rel="stylesheet">
+
+ <style>
+
+ body {
+ padding-top: 50px;
+ }
+
+ .div {
+ border: 0.1em solid black;
+ }
+
+
+ /* lg */
+ @media (min-width: 1200px) {
+ html, body, #app, #app-row {
+ height: 100%;
+ }
+
+ .div {
+ overflow: auto;
+ /*min-height: 100%;*/
+ height: 100%;
+ }
+ }
+
+ /* md */
+ @media (min-width: 992px) and (max-width: 1199px) {
+ html, body, #app, #app-row {
+ height: 100%;
+ }
+
+ .div {
+ overflow: auto;
+ /*min-height: 100%;*/
+ height: 50%;
+ }
+ }
+
+
+ /* sm */
+ @media (min-width: 768px) and (max-width: 991px) {
+ }
+
+ /* xs */
+ @media (max-width: 767px) {
+
+ }
+/*
+ .ui-resizable-handle {
+ position: absolute;
+ font-size: 0.1px;
+ z-index: 99999;
+ display: block;
+ }
+ .ui-resizable-e {
+ background: #192f42;
+ box-shadow: inset 0 0 0 rgba(180,180,180,0.3), 0 -1px 1px rgba(0,0,0,0.3);
+ width:10px;
+ z-index: 88 !important;
+ }
+ .ui-resizable-e:after {
+ content: "-";
+ display: block;
+ position: absolute;
+ top: calc(50% - 16px);
+ left: 0;
+ height: 30px;
+ width: 10px;
+ background-color: rgba(0,0,0,0.1);
+ }
+ .ui-resizable-s {
+ background: #192f42;
+ box-shadow: inset 0 1px 0 rgba(100,100,100,0.3), 0 0 0 rgba(40,40,40,0.3);
+ height:10px;
+ }
+ .ui-resizable-s:after {
+ content: "-";
+ display: block;
+ position: absolute;
+ top: 1px;
+ left: calc(50% - 20px);
+ height: 8px;
+ width: 38px;
+ background-color: rgba(0,0,0,0.1);
+ }
+
+*/
+ </style>
+
+
+ <!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
+ <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
+ <!--[if lt IE 9]>
+ <script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
+ <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
+ <![endif]-->
+</head>
+<body>
+
+<div class="navbar navbar-inverse navbar-fixed-top">
+ <div class="container-fluid">
+ <div class="navbar-header">
+ <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
+ <span class="icon-bar"></span>
+ <span class="icon-bar"></span>
+ <span class="icon-bar"></span>
+ </button>
+ <a class="navbar-brand" href="#">CodeQ</a>
+ </div>
+ <div class="collapse navbar-collapse">
+ <ul class="nav navbar-nav">
+ <li class="active"><a href="#">Home</a></li>
+ <li><a href="#about">About</a></li>
+ <li><a href="#contact">Contact</a></li>
+ </ul>
+ </div><!--/.nav-collapse -->
+ </div>
+</div>
+
+<div class="container-fluid" id="app">
+ <div class="row" id="app-row">
+ <div class="col-lg-3 col-md-6 col-sm-12 col-xs-12 div ui-resizable" id="infoPane">
+ <h2 class="text-center"><span>Instructions</span></h2>
+ <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
+ <p>Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt explicabo. Nemo enim ipsam voluptatem quia voluptas sit aspernatur aut odit aut fugit, sed quia consequuntur magni dolores eos qui ratione voluptatem sequi nesciunt. Neque porro quisquam est, qui dolorem ipsum quia dolor sit amet, consectetur, adipisci velit, sed quia non numquam eius modi tempora incidunt ut labore et dolore magnam aliquam quaerat voluptatem. Ut enim ad minima veniam, quis nostrum exercitationem ullam corporis suscipit laboriosam, nisi ut aliquid ex ea commodi consequatur? Quis autem vel eum iure reprehenderit qui in ea voluptate velit esse quam nihil molestiae consequatur, vel illum qui dolorem eum fugiat quo voluptas nulla pariatur? Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
+ </div>
+ <div class="col-lg-3 col-md-6 col-sm-12 col-xs-12 div ui-resizable" id="editorPane">
+ <h2 class="text-center"><span>Editor</span></h2>
+ <p>Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt explicabo. Nemo enim ipsam voluptatem quia voluptas sit aspernatur aut odit aut fugit, sed quia consequuntur magni dolores eos qui ratione voluptatem sequi nesciunt. Neque porro quisquam est, qui dolorem ipsum quia dolor sit amet, consectetur, adipisci velit, sed quia non numquam eius modi tempora incidunt ut labore et dolore magnam aliquam quaerat voluptatem. Ut enim ad minima veniam, quis nostrum exercitationem ullam corporis suscipit laboriosam, nisi ut aliquid ex ea commodi consequatur? Quis autem vel eum iure reprehenderit qui in ea voluptate velit esse quam nihil molestiae consequatur, vel illum qui dolorem eum fugiat quo voluptas nulla pariatur? Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
+ </div>
+ <div class="col-lg-3 col-md-6 col-sm-12 col-xs-12 div ui-resizable" id="cmdPane">
+ <h2 class="text-center"><span>Prompt</span></h2>
+ <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
+ <p>Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt explicabo. Nemo enim ipsam voluptatem quia voluptas sit aspernatur aut odit aut fugit, sed quia consequuntur magni dolores eos qui ratione voluptatem sequi nesciunt. Neque porro quisquam est, qui dolorem ipsum quia dolor sit amet, consectetur, adipisci velit, sed quia non numquam eius modi tempora incidunt ut labore et dolore magnam aliquam quaerat voluptatem. Ut enim ad minima veniam, quis nostrum exercitationem ullam corporis suscipit laboriosam, nisi ut aliquid ex ea commodi consequatur? Quis autem vel eum iure reprehenderit qui in ea voluptate velit esse quam nihil molestiae consequatur, vel illum qui dolorem eum fugiat quo voluptas nulla pariatur? Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
+ </div>
+ <div class="col-lg-3 col-md-6 col-sm-12 col-xs-12 div ui-resizable" id="hintPane">
+ <h2 class="text-center"><span>Hint</span></h2>
+ <p>At vero eos et accusamus et iusto odio dignissimos ducimus qui blanditiis praesentium voluptatum deleniti atque corrupti quos dolores et quas molestias excepturi sint occaecati cupiditate non provident, similique sunt in culpa qui officia deserunt mollitia animi, id est laborum et dolorum fuga. Et harum quidem rerum facilis est et expedita distinctio. Nam libero tempore, cum soluta nobis est eligendi optio cumque nihil impedit quo minus id quod maxime placeat facere possimus, omnis voluptas assumenda est, omnis dolor repellendus. Temporibus autem quibusdam et aut officiis debitis aut rerum necessitatibus saepe eveniet ut et voluptates repudiandae sint et molestiae non recusandae. Itaque earum rerum hic tenetur a sapiente delectus, ut aut reiciendis voluptatibus maiores alias consequatur aut perferendis doloribus asperiores repellat. Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
+ </div>
+ </div><!--/row-->
+</div><!--container-->
+
+<!-- jQuery stuff -->
+<script src="js/jquery/jquery-1.11.3.js"></script>
+<!--script src="js/jquery/jquery.terminal-0.8.8.js"></script-->
+<script src="js/jquery/jquery.console.js"></script>
+<!-- Bootstrap -->
+<script src="js/bootstrap/bootstrap.min.js"></script>
+<!-- jQuery UI -->
+<script src="js/jquery/jquery-ui.min.js"></script>
+
+<script type="text/javascript">
+
+/* var resizePanes = function () {
+ if ($(window).width()>=992) {
+ $('#infoPane').$('.ui-resizable-e').removeClass('hide');
+ $('#infoPane').$('.ui-resizable-s').removeClass('hide');
+ $('#editorPane').$('.ui-resizable-e').removeClass('hide');
+ $('#editorPane').$('.ui-resizable-s').addClass('hide');
+ $('#cmdPane').$('.ui-resizable-s').addClass('hide');
+ $('#cmdPane').$('.ui-resizable-e').removeClass('hide');
+ $('#hintPane').$('.ui-resizable-e').addClass('hide');
+ $('#hintPane').$('.ui-resizable-s').addClass('hide');
+ }
+ if ($(window).width()>=1200) {
+ $('#cmdPane').$('.ui-resizable-e').removeClass('hide');
+ $('#hintPane').$('.ui-resizable-e').addClass('hide');
+ $('.ui-resizable-s').addClass('hide');
+ }
+ else {
+ $('.ui-resizable-handle').addClass('hide');
+ }
+ };
+*/
+
+ var resizePanes = function () {
+ if ($(window).width()<=991) {
+ $('.ui-resizable-handle').addClass('hide');
+ }
+ else {
+ $('.ui-resizable-handle').removeClass('hide');
+ }
+ };
+
+ $(window).bind("resize", function(event){
+ console.log("resize ...");
+ resizePanes();
+ });
+
+ $.widget("ui.resizable", $.ui.resizable, {
+ resizeTo: function(newSize) {
+ var start = new $.Event("mousedown", { pageX: 0, pageY: 0 });
+ this._mouseStart(start);
+ this.axis = 'se';
+ var end = new $.Event("mouseup", {
+ pageX: newSize.width - this.originalSize.width,
+ //pageX: this.originalSize.width,
+ pageY: newSize.height - this.originalSize.height
+ });
+ console.log(end);
+ this._mouseDrag(end);
+ this._mouseStop(end);
+ }
+ });
+ $(function() {
+ $( ".ui-resizable" ).resizable();
+ });
+
+ $('.div').resizable({
+ handles: 's,e',
+ minWidth: $(window).width()*0.1,
+ //minHeight: 100,
+ maxWidth: $(window).width()*0.9,
+ //maxHeight: 500,
+ resize:function(event,ui){
+ var x=ui.element.outerWidth(),
+ y=ui.element.outerHeight(),
+ xpar=$(this).parent().width()-1,
+ ypar=$(this).parent().height()-1,
+ infoPane=$('#infoPane'), xi=infoPane.outerWidth(), yi=infoPane.outerHeight(),
+ editorPane=$("#editorPane"), xe=editorPane.outerWidth(),
+ cmdPane=$("#cmdPane"), xc= cmdPane.outerWidth(), yc= cmdPane.outerHeight(),
+ hintPane=$("#hintPane"), xh=hintPane.outerWidth(),
+ ele=ui.element,
+ id=ele[0].id;
+
+ console.log(ui, ele, id);
+ console.log(x, y, xpar, ypar);
+
+
+ if ($(window).width()>=1200) {
+ if (id==='infoPane') {
+ editorPane.css('width',(xpar-x-xc-xh)+'px');
+ cmdPane.css('width',(xc)+'px');
+ hintPane.css('width',(xh)+'px');
+ }
+ if (id==='editorPane') {
+ infoPane.css('width',(xi)+'px');
+ cmdPane.css('width',(xpar-x-xi-xh)+'px');
+ hintPane.css('width',(xh)+'px');
+ }
+ if (id==='cmdPane') {
+ infoPane.css('width',(xi)+'px');
+ editorPane.css('width',(xe)+'px');
+ hintPane.css('width',(xpar-x-xi-xe)+'px');
+ }
+ if (id==='hintPane') {
+ infoPane.css('width',(xi)+'px');
+ editorPane.css('width',(xe)+'px');
+ cmdPane.css('width',(xpar-x-xi-xh)+'px');
+ }
+
+ }
+ if (($(window).width()>=992) && ($(window).width()<1200)) {
+ if (id==='infoPane') {
+ editorPane.css('width',(xpar-x)+'px');
+ editorPane.css('height',(y)+'px');
+ cmdPane.css('width',(x)+'px');
+ cmdPane.css('height',(ypar-y)+'px');
+ hintPane.css('width',(xpar-x)+'px');
+ hintPane.css('max-height',(ypar-y)+'px');
+ }
+ if (id==='editorPane') {
+ infoPane.css('width',(xpar-x)+'px');
+ infoPane.css('height',(y)+'px');
+ cmdPane.css('width',(xpar-x)+'px');
+ cmdPane.css('height',(ypar-y)+'px');
+ hintPane.css('width',(x)+'px');
+ hintPane.css('height',(ypar-y)+'px');
+ }
+ if (id==='cmdPane') {
+ infoPane.css('width',(x)+'px');
+ infoPane.css('height',(ypar-y)+'px');
+ editorPane.css('width',(xpar-x)+'px');
+ editorPane.css('height',(ypar-y)+'px');
+ hintPane.css('width',(xpar-x)+'px');
+ hintPane.css('height',(y)+'px');
+ }
+ if (id==='hintPane') {
+ infoPane.css('width',(xpar-x)+'px');
+ infoPane.css('height',(ypar-y)+'px');
+ editorPane.css('width',(x)+'px');
+ editorPane.css('height',(ypar-y)+'px');
+ cmdPane.css('width',(xpar-x)+'px');
+ cmdPane.css('height',(y)+'px');
+ }
+ }
+ else { //($(window).width()<=991)
+ //not resizable
+ }
+ //ele.next().css('height',y+'px');
+ //ele.next().css('width',(factor/3)+'px');
+ //ele.next().next().css('width',(factor/3)+'px');
+ //ele.next().next().next().css('width',(factor/3)+'px');
+ resizePanes();
+ }
+ }).on('resize', function (e) {
+ e.stopPropagation();
+ });
+
+ resizePanes();
+</script>
+</body>
+</html> \ No newline at end of file