LOADING...

Preview

Pen ID
Unlock Campus Themeforest adv

 

Code

Here is more content. This could be related items, navigation or other content you feel is conducive to this type of treatment.

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aenean quis nisi et dui placerat ornare. Maecenas molestie lacus lobortis libero lacinia sed scelerisque lectus congue. Mauris dignissim nisi a ante laoreet et ullamcorper ligula ullamcorper. In hac habitasse platea dictumst. In nisi odio, tempor in viverra vitae, mollis ac tortor. Sed a rhoncus leo. Maecenas ac dui elit, tristique dapibus nisl. Suspendisse feugiat porta ligula, auctor posuere lorem vulputate et.

Off-Canvas Top

More content or navigation can be displayed off-canvas above the core content.

Pros

  • Saves space for core content.
  • Elegant

Cons

  • JS Dependency - Not necessarily a con, but ensure that off-canvas content is still accessible for users with poor/no JS support
  • Animation Performance - Platforms, especially mobile platforms, vary greatly in how well they treat animations. Keep this in mind.

Resources

CSS
.offcanvas-top {
  position: relative;
  overflow: hidden;
  height: 3.2em;
  -webkit-transition: height 0.5s ease-out; 
  -moz-transition: height 0.5s ease-out;  
  -o-transition: height 0.5s ease-out; 
  transition: height 0.5s ease-out;
}
.offcanvas-top.active {
  height: 13.6em;
}
.o-content {
  width: 100%;
  position: absolute;
  bottom: 0;
  padding: 1em 1em 2.5em;
  
}
.crumbs li a {
  display: block;
  padding: 1em;
  border-bottom: 1px solid #000;
}
.crumbs li:last-child a {
  border-bottom: 0;
}
#trigger {
  position: absolute;
  bottom: 0;
  right: 0;
  display: block;
  font-size: 1em; 
  padding: 0 1em 1em;
}
JS
(function(w){
      var $container = $('.offcanvas-top'),
				$cHeight = $('.o-content').outerHeight();
			$(document).ready(function() {
				buildCanvas();
			});
			
			function buildCanvas() {
				$('More +').appendTo($container);

				$('#trigger').bind('click', function(e) {
					e.preventDefault();
					var $this = $(this);
					$container.toggleClass('active');
					if($container.hasClass('active')) {
						$container.height($cHeight);
						$this.text('Hide -');
					} else {
						$container.height(50);
						$this.text('More +');
					}
				});

			}
			
			$(window).resize(function() { //On Window resizeBy(
				$cHeight = $('.o-content').outerHeight();
        console.log($cHeight);
			});
			
			
		})(this);

Description

More content or navigation can be displayed off-canvas above the core content.
Term
Mon, 11/27/2017 - 21:26

Related Codes

Pen ID
Pen ID
Pen ID
Square Adv