<!-- info pulled from http://10mosttoday.com/10-most-beautiful-forests-in-the-world/ -->
<body ng-app='app' ng-controller='MainController'>
<main id='main'>
<section id='one'>
<div class='pane'
ng-repeat='forest in forests track by $index'
ng-if="$index == active">
<main>
<h1 ng-style="{'background-image' : 'url(' + forest.img + ')'}">{{ forest.rank }}</h1>
</main>
<div class="bg" ng-style="{'background-image' : 'url(' + forest.img + ')'}"></div>
</div>
</section>
<section id='two'>
<div class='pane'
ng-repeat='forest in forests track by $index'
ng-class="{ 'active' : $index == active }"
ng-if="$index == active">
<main>
<h2>{{ forest.name }}</h2>
<p>{{ forest.desc }}</p>
<p class='sub'>{{ forest.location }}</p>
</main>
</div>
</section>
</main>
<nav id='nav'>
<ul>
<li class="previous" ng-show="active > 0">
<a href='#' ng-click="previous()">
<span class='icon icon_arrow-left'></span>
</a>
</li>
<li class='numbers'>
<a href='#' ng-repeat="forest in forests track by $index" ng-click="setActive($index)" ng-class="{'active' : $index == active}">
{{ $index + 1 }}
</a>
</li>
<li class="next" ng-show="active + 1 < forests.length">
<a href='#' ng-click="next()">
<span class='icon icon_arrow-right'></span>
</a>
</li>
</ul>
</nav>
<div id="preloader">
<img src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/130891/sagano.jpg" alt="" />
<img src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/130891/sequoia.jpg" alt="" />
<img src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/130891/redwoods.jpg" alt="" />
<img src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/130891/black-forest.jpg" alt="" />
<img src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/130891/crooked-forest.jpg" alt="" />
</div>
</body>
@import "compass/css3";
@import "compass/reset";
@import "compass/css3";
/* Coolors Exported Palette - coolors.co/97dffc-858ae3-613dc1-4e148c-2c0735 */
$color1: #E26D5A;
$color2: #858ae3;
$color3: #613dc1;
$color4: #4e148c;
$color5: #2c0735;
// Grid
$line: 22px;
// Defaults
$default-transition-function: cubic-bezier(.65,.19,.08,.97);
$default-transition-duration: 0.5s;
// Typography
body {
background: lighten($color2, 27);
font-family: "ocr-b-std",sans-serif;
font-style: normal;
font-weight: 400;
color: lighten($color1, 25);
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
h1, h2, h3, h4 {
font-family: "acta-display",sans-serif;
font-style: normal;
font-weight: 900;
color: $color5;
}
h1 {
@include single-transition(opacity, .5s);
opacity: .75;
background: url(https://s3-us-west-2.amazonaws.com/s.cdpn.io/130891/sagano.jpg) no-repeat center center fixed;
-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
background-size: cover;
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
}
h2 { font-size: 56px; margin-bottom: $line; }
p {
font-size: 13px;
line-height: $line;
text-align: justify;
margin-bottom: $line;
}
.sub {
text-transform: uppercase;
font-size: 12px;
}
.icon {
font-size: 21px;
}
// Basic Layout
* { @include box-sizing(border-box); }
body, html { height: 100%; }
#main {
padding: 1em;
width: 100%;
height: 100%;
padding-bottom: $line*3;
margin-bottom: -$line*3;
}
#one, #two {
position: relative;
float: left;
height: 100%;
width: 50%;
overflow: hidden;
}
#one {
background: rgba(lighten($color2, 27), 1);
@include transition;
text-align: center;
.bg {
content: "";
background: url(https://s3-us-west-2.amazonaws.com/s.cdpn.io/130891/sagano.jpg) no-repeat center center fixed;
-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
background-size: cover;
opacity: 0.75;
top: 0; left: 0; bottom: 0; right: 0;
position: absolute;
z-index: -1;
}
&:hover {
h1 { opacity: 0; }
background: rgba(lighten($color2, 27), 0);
}
h1 {
position: relative;
margin-top: -20px;
font-size: 750px;
font-size: 60vw;
}
}
@media (min-width: 1400px) {
#one h1 {
font-size: 838px;
}
}
#two {
background: lighten($color2, 27);
color: desaturate($color3, 40);
main { padding: 0 20% 0 2em; }
.pane {
&.active {
@include animation(fade-in $default-transition-duration*2 0 normal $default-transition-function);
}
}
}
// Panes
.pane {
top: 0;
display: flex;
height: 100%;
width: 100%;
position: absolute;
main {
margin: auto;
position: relative;
z-index: 1;
}
}
.pane.ng-enter, .pane.ng-leave {
@include transition;
}
#one .pane {
&.ng-leave,
&.ng-enter.ng-enter-active { top: 0; }
&.ng-enter { top: -100%; }
&.ng-leave.ng-leave-active { top: 100%; }
}
#two .pane {
&.ng-leave,
&.ng-enter.ng-enter-active { top: 0; }
&.ng-enter { top: 100%; }
&.ng-leave.ng-leave-active { top: -100%; }
}
// Navigation Bar
#nav {
position: relative;
overflow: hidden;
background: lighten($color2, 27);
width: 100%;
height: $line*3;
li {
position: absolute;
text-align: center;
a {
display: block;
padding: 0 1em;
color: $color5;
text-decoration: none;
height: $line*3;
line-height: $line*3;
.icon { line-height: $line*3; }
}
}
li.previous, li.next {
background: white;
width: 150px;
z-index: 2;
bottom: 0;
&.ng-hide-add.ng-hide-add-active,
&.ng-hide-remove.ng-hide-remove-active {
@include transition;
}
&.ng-hide {
bottom: -$line*3;
}
}
li.previous { left: 0; }
li.next { right: 0; }
li.numbers {
z-index: 0;
width: 100%;
margin: 0 auto;
left: 0; right: 0;
a {
display: inline;
&.active { color: $color2; }
}
}
}
@include keyframes(fade-in) {
0% { opacity: 0; }
100% { opactiy: 1; }
}
// Image Preloader
#preloader {
opacity: 0;
position: absolute;
z-index: -100;
width: 0; height: 0;
overflow: hidden;
}
View Compiled
angular.module('app', ['cfp.hotkeys', 'ngAnimate'])
.controller('MainController', function($scope, hotkeys) {
// functions
$scope.active = 0;
$scope.previous = function() {
if($scope.active != 0) $scope.active -= 1;
}
$scope.next = function() {
if($scope.active + 1 < $scope.forests.length) $scope.active += 1;
}
$scope.setActive = function(i) {
$scope.active = i;
}
$scope.forests = [
{
'rank' : 1,
'name' : 'Sagano Bamboo Forest',
'desc' : 'A magnificent Bamboo forest in the district of Arashiyama, west to Kyoto, Japan.',
'location' : 'Kyoto, Japan',
'img' : 'https://s3-us-west-2.amazonaws.com/s.cdpn.io/130891/sagano.jpg'
},
{
'rank' : 2,
'name' : 'Giant Sequoia National Monument',
'desc' : 'Located in the southern Sierra Nevada mountains of California. The forest is named for the majestic Giant Sequoia trees which populate 38 distinct groves within the boundaries of the forest. The Sequoia National Forest covers 4,829 sq km (1,865 sq mi).',
'location' : 'California, United States',
'img' : 'https://s3-us-west-2.amazonaws.com/s.cdpn.io/130891/sequoia.jpg'
},
{
'rank' : 3,
'name' : 'Redwood National Park',
'desc' : 'Also in California, The Redwood National parks is a combination of four parks that together protect 45% of all remaining coast redwood (Sequoia sempervirens) old-growth forests, totaling at least 158 square km. These trees are the tallest and one of the most massive tree species on Earth.',
'location' : 'California, United States',
'img' : 'https://s3-us-west-2.amazonaws.com/s.cdpn.io/130891/redwoods.jpg'
},
{
'rank' : 4,
'name' : 'Black Forest',
'desc' : 'Schwarzwald or “Black Forest” is a wooded mountain range in Baden-Württemberg, southwestern Germany. It is bordered by the Rhine valley to the west and south. The name “Black Forest” was given by the Romans who referred to the forest blocking out most of the sunlight from getting inside the forest by the dense growth of conifers.',
'location' : 'Germany',
'img' : 'https://s3-us-west-2.amazonaws.com/s.cdpn.io/130891/black-forest.jpg'
},
{
'rank' : 5,
'name' : 'Crooked Forest',
'desc' : 'A grove of oddly-shaped pine trees. This young forest was planted around 1930 and has about 400 pines. It is generally believed that some form of human tool or technique was used to make the trees grow this way, but the method and motive are not currently known. Some believe that the woods were deliberately grown this way to make “Compass Timbers”, or trees that are deliberately shaped for the purpose of using those odd shapes in ship building. Another theory is that tanks from WWII are the cause, rolling over the young trees snapping the stem, but still surviving, forcing them to grow in the direction they were ran over.',
'location' : 'Poland',
'img' : 'https://s3-us-west-2.amazonaws.com/s.cdpn.io/130891/crooked-forest.jpg'
}
];
// hot keys
hotkeys.add({
combo: 'right',
description: 'Next slide',
callback: function() {
$scope.next();
}
});
hotkeys.add({
combo: 'left',
description: 'Previous slide',
callback: function() {
$scope.previous();
}
});
});
This Pen doesn't use any external CSS resources.