cssAudio - Activefile-genericCSS - ActiveGeneric - ActiveHTML - ActiveImage - ActiveJS - ActiveSVG - ActiveText - Activefile-genericVideo - ActiveLovehtmlicon-new-collectionicon-personicon-teamlog-outoctocatpop-outspinnerstartv

Pen Settings

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

Quick-add: + add another resource

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

Quick-add: + add another resource

Code Indentation

     

Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

            
              <script type="text/javascript" src="//code.jquery.com/jquery-1.11.1.min.js"></script>
<script type="text/javascript" src="//golden-layout.com/assets/js/goldenlayout.min.js"></script>
<link type="text/css" rel="stylesheet" href="//golden-layout.com/assets/css/goldenlayout-base.css" />
<link type="text/css" rel="stylesheet" href="//golden-layout.com/assets/css/goldenlayout-dark-theme.css" />

<div id="layoutContainer"></div>
            
          
!
            
              .messageCounter{
	position: absolute;
	right: -5px;
	top: -5px;
	background: #ad5000;
	color:#fff;
	font-weight: bold;
	z-index: 4;
	padding: 2px 5px;
	border-radius: 50px;
}

.lm_active .messageCounter{
  background: #ee7813;
}

html, body{
  margin: 0;
  height: 100%;
  background: #000;
}

#layoutContainer{
  height:98%;
  bottom: 0;
  width: 100%;
  position: absolute;
}
.btnContainer{
  width: 300px;
  margin: 0 auto;
  position: relative;
  top: 50%;
  margin-top: -30px;
}
button {
	-moz-box-shadow:inset 0px 1px 0px 0px #777;
	-webkit-box-shadow:inset 0px 1px 0px 0px #777;
	box-shadow:inset 0px 1px 0px 0px #777;
	background:-webkit-gradient(linear, left top, left bottom, color-stop(0.05, #403f40), color-stop(1, #1f1f1f));
	background:-moz-linear-gradient(top, #403f40 5%, #1f1f1f 100%);
	background:-webkit-linear-gradient(top, #403f40 5%, #1f1f1f 100%);
	background:-o-linear-gradient(top, #403f40 5%, #1f1f1f 100%);
	background:-ms-linear-gradient(top, #403f40 5%, #1f1f1f 100%);
	background:linear-gradient(to bottom, #403f40 5%, #1f1f1f 100%);
	filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#403f40', endColorstr='#1f1f1f',GradientType=0);
	background-color:#403f40;
	-moz-border-radius:6px;
	-webkit-border-radius:6px;
	border-radius:6px;
	border:1px solid #2e2e2e;
  margin: 0 10px;
	display:inline-block;
	cursor:pointer;
	color:#d6d6d6;
	font-family:arial;
	font-size:30px;
	font-weight:bold;
  outline: none;
	padding:12px 0;
	text-decoration:none;
	text-shadow:0px 1px 0px #000000;
  width: 100px;
  
}
button:hover {
	background:-webkit-gradient(linear, left top, left bottom, color-stop(0.05, #1f1f1f), color-stop(1, #403f40));
	background:-moz-linear-gradient(top, #1f1f1f 5%, #403f40 100%);
	background:-webkit-linear-gradient(top, #1f1f1f 5%, #403f40 100%);
	background:-o-linear-gradient(top, #1f1f1f 5%, #403f40 100%);
	background:-ms-linear-gradient(top, #1f1f1f 5%, #403f40 100%);
	background:linear-gradient(to bottom, #1f1f1f 5%, #403f40 100%);
	filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#1f1f1f', endColorstr='#403f40',GradientType=0);
	background-color:#1f1f1f;
}
button:active {
	position:relative;
	top:1px;
}



            
          
!
            
              var config = {
	content: [{
		type: 'column',
		content: [{
			type:'component',
			componentName: 'example',
			componentState: { startCount: 6 }
		},{
		type: 'stack',
		content:[{
				type:'component',
				componentName: 'example',
				componentState: { startCount: 1 }
			},{
				type:'component',
				componentName: 'example',
				componentState: { startCount: 2 }
			}]
		}]
	}]
};

var myLayout = new GoldenLayout( config, '#layoutContainer' );

myLayout.registerComponent( 'example', function( container, state ){
		var counter = $('<div class="messageCounter">' + state.startCount + '</div>'),
        btnContainer = $('<div class="btnContainer"></div>'),
			count = state.startCount;

     container.getElement().append( btnContainer );
  
		function makeButton( label, increment ) {
			var button = $( '<button class="button">' + label + '</button>' );
			
			button.click(function(){
				count += increment;
				counter.text( count );
			});
      
        btnContainer.append( button );
		}
     
    // Add the counter element whenever a tab is created
		container.on( 'tab', function( tab ){
			tab.element.append( counter );
		});

		makeButton( '+', 1 );
		makeButton( '-', -1 );
	});

myLayout.init();

/*
* Since our layout is not a direct child
* of the body we need to tell it when to resize
*/
$(window).resize(function(){
  myLayout.updateSize();
})

            
          
!
999px
Loading ..................

Console