Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URLs added here will be added as <link>s in order, and before the CSS in the editor. You can use the CSS from another Pen by using its URL and the proper URL extension.

+ add another resource

JavaScript

Babel includes JSX processing.

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.

+ add another resource

Packages

Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.

Behavior

Auto Save

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.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

HTML

              
                <section class="board__wrap">
    <div class="board">
        <article class="board__cta board__cta--1">
            <div class="board__frame">
                <div class="board__deck">
                    <div class="board__name">
                        SPAD XIII
                    </div>
                </div>
                <div class="board__detail-wrap">
                    <div class="board__detail">
                        <div class="board__stat--flex" data-stat="8">flex</div>
                        <div class="board__stat--entergy" data-stat="9">entergy</div>
                        <div class="board__stat--carve" data-stat="9">carve</div>
                        <div class="board__stat--gs-carve" data-stat="7">gs-carve</div>
                        <div class="board__text">
                            <p>Description of the board. Etiam vitae tortor. Vestibulum suscipit nulla quis orci. Praesent adipiscing. Curabitur turpis. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; In ac dui quis mi consectetuer lacinia.</p>
                            <a href="#" class="btn">[ read more ]</a>
                        </div>
                    </div>
                </div>
            </div>
        </article>
        <article class="board__cta board__cta--2">
            <div class="board__frame">
                <div class="board__deck">
                    <div class="board__name">
                        NIEUPORT 17
                    </div>
                </div>
                <div class="board__detail-wrap">
                    <div class="board__detail">
                        <div class="board__stat--flex" data-stat="8">flex</div>
                        <div class="board__stat--entergy" data-stat="9">entergy</div>
                        <div class="board__stat--carve" data-stat="9">carve</div>
                        <div class="board__stat--gs-carve" data-stat="7">gs-carve</div>
                        <div class="board__text">
                            <p>Description of the board. Etiam vitae tortor. Vestibulum suscipit nulla quis orci. Praesent adipiscing. Curabitur turpis. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; In ac dui quis mi consectetuer lacinia.</p>
                            <a href="#" class="btn">[ read more ]</a>
                        </div>
                    </div>
                </div>
            </div>
        </article>
        <article class="board__cta board__cta--3">
            <div class="board__frame">
                <div class="board__deck">
                    <div class="board__name">
                        HANDLEY PAGE
                    </div>
                </div>
                <div class="board__detail-wrap">
                    <div class="board__detail">
                        <div class="board__stat--flex" data-stat="8">flex</div>
                        <div class="board__stat--entergy" data-stat="9">entergy</div>
                        <div class="board__stat--carve" data-stat="9">carve</div>
                        <div class="board__stat--gs-carve" data-stat="7">gs-carve</div>
                        <div class="board__text">
                            <p>Description of the board. Etiam vitae tortor. Vestibulum suscipit nulla quis orci. Praesent adipiscing. Curabitur turpis. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; In ac dui quis mi consectetuer lacinia.</p>
                            <a href="#" class="btn">[ read more ]</a>
                        </div>
                    </div>
                </div>
            </div>
        </article>
        <article class="board__cta board__cta--4">
            <div class="board__frame">
                <div class="board__deck">
                    <div class="board__name">
                        SOPWITH PUP
                    </div>
                </div>
                <div class="board__detail-wrap">
                    <div class="board__detail">
                        <div class="board__stat--flex" data-stat="8">flex</div>
                        <div class="board__stat--entergy" data-stat="9">entergy</div>
                        <div class="board__stat--carve" data-stat="9">carve</div>
                        <div class="board__stat--gs-carve" data-stat="7">gs-carve</div>
                        <div class="board__text">
                            <p>Description of the board. Etiam vitae tortor. Vestibulum suscipit nulla quis orci. Praesent adipiscing. Curabitur turpis. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; In ac dui quis mi consectetuer lacinia.</p>
                            <a href="#" class="btn">[ read more ]</a>
                        </div>
                    </div>
                </div>
            </div>
        </article>
    </div>
</section>
<footer>
    <p>Proof of concept for the <a href="http://www.kotalongboards.com/" target="_blank">Kota Longboards</a> site by <a href="http://www.tcmulder.com" target="_blank">Tomas Mulder</a> for <a href="http://www.zenman.com" target="_blank">Zenman</a>.</p>
    <p>Check out the <a href="https://codepen.io/tcmulder/pen/bdeaMy" target="_blank">CSS-only version</a>.</p>
</footer>

              
            
!

CSS

              
                /*----------------------*\
  :: Dev
\*----------------------*/
/*.board__cta {
      box-shadow: 0 0 1px rgba(teal,.5) inset;
}*/

/*----------------------*\
  :: The Magic
\*----------------------*/
// number of pages
$num-ctas: 4;
.board__cta {
    @media screen and (min-width: 701px){
        width: 100%/$num-ctas;
        &.active {
            width: 100%*.75;
        }
        &.inactive{
            width: 100%*.25/($num-ctas - 1);
        }
    }
    @media screen and (max-width: 700px){
        width: 100%;
    }
}

/*----------------------*\
  :: Styling
\*----------------------*/
*, *:before, *:after {
    box-sizing:border-box;
}
html, body {
    height: 100%;
}
.board__wrap {
    @media screen and (min-width: 701px){
        position: relative;
        float: left;
        width: 100%;
        padding-bottom: 3em;
        overflow: hidden;
        &:before {
            content: "";
            position: absolute;
            left: 0;
            right: 0;
            bottom: 0;
            top: 0;
            background: rgba(#fff,0);
            z-index: 100;
            transition: 300ms;
        }
        &.active{
            &:before{
                background: rgba(#fff,0.8);
                cursor: pointer;
            }
        }
    }
}
.board {
    display: block;
    width: 100%;
    height: 45em;
    max-width: 75em;
    min-width: 20em;
    margin: 0 auto; 
    font-family: "Trebuchet MS", sans-serif;
    line-height: 1.5;
    letter-spacing: .05em;
    cursor: default;
    color: black;
    text-decoration: none;
    @media screen and (max-width: 1024px){
        font-size: .7em;
    }
    @media screen and (max-width: 700px){
        max-width: 45em;
        font-size: .9em;
    }
    @media screen and (max-width: 460px){
        font-size: .65em;
    }
    h3 {
        margin-bottom: 0;
    }
    p {
        margin-top: 0;
    }
}
.board__cta {
    position: relative;
    float: left;
    height: 100%;
    padding: 1em;
    margin: 5% auto 0;
    transition: 300ms;
    cursor: pointer;
    @media screen and (min-width: 701px){
        &.inactive {
            z-index: 0;
        }
        &.active {
            cursor: default;
        }
    }
    @media screen and (max-width: 700px){
        max-width: 45em;
        width: 100%;
        padding: 4em 0;
        border-top: 2px solid #e8e8e8;
        min-height: 50em;
        &:first-child {
            border-top: none;
        }
    }
}
.board__frame {
    position: relative;
    display: inline-block;
    width: 20em;
    height: 100%;
    @media screen and (min-width: 701px){
        width: 20em;
    }
    @media screen and (max-width: 700px){
        display: block;
        width: 30em;
        margin: 0 auto;
    }
}
.board__deck {    
    position: absolute;
    z-index: 100;
    left: 0;
    width: 10em;
    height: 42em;
    transition: 300ms;
    perspective: 1000;
    background: transparent;
    transform-style: preserve-3d;
    transition: 300ms;
    cursor: pointer;
     background: radial-gradient(
            ellipse at 50% 50%,
            rgba(0,0,0,.3) 0%,
            rgba(0,0,0,.2) 30%,
            rgba(0,0,0,0) 70%,
            rgba(0,0,0,0) 100%);
    background-size: 8em 1.5em;
    background-position: center bottom;
    background-repeat: no-repeat;
    @media screen and (min-width: 701px){
        position: absolute;
        left: 25%;
        transform: translateX(-25%);
        .board__cta.active & {
            left: 20%;
            z-index: 150;
            @media screen and (min-width: 701px){
                transform: translateX(25%);
            }
        }
        .board__cta.inactive & {
            height: 40em;
            @media screen and (min-width: 701px){
                transform: translateX(-30%);
            }
            @media screen and (max-width: 700px){
                z-index: 150;
            }
        }
    }
    @media screen and (max-width: 700px){
        position: relative;
        width: 30%;
        float: left;
        .board__cta:nth-child(even) & {
            float: right;
        }
    }
    &.active {
        &:before, &:after {
            transform: rotateY(180deg);
        }
        &:after {
            opacity: 0;
        }
        &:before {
            opacity: 1;
        }
    }
    &:before, &:after {
        content: "";
        position: absolute;
        top: 0; left: 0; right: 0; bottom: 3em;
        background-size: contain;
        background-repeat: no-repeat;
        background-position: center;
        transition: transform 500ms, opacity 100ms 125ms;
    }
    &:before {
        opacity: 0;
        
    }
    @for $i from 1 through $num-ctas {
        .board__cta--#{$i} &:before {
            background-image: url(//www.tcmulder.com/codepen/board-cta/#{$i}-bottom.png);
        }
        .board__cta--#{$i} &:after {
            background-image: url(//www.tcmulder.com/codepen/board-cta/#{$i}-top.png);
        }
    }
}
.board__name {
    position: absolute;
    top: 55%;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10;
    width: 10em;
    padding: .5em 0;
    background-color: #fff;
    font-size: 1.5em;
    text-align: center;
    transition: opacity 300ms;
    font-family: "Arial Narrow", Arial, sans-serif;
    @media screen and (max-width: 700px){
        display: none;
    }
    .active & {
        opacity: 0;
    }
}
.board__detail-wrap {
    position: absolute;
    width: 10em;
    height: 42em;
    top: 0;
    transition: 300ms;
    z-index: 100;
    @media screen and (min-width: 701px){
        position: absolute;
        left: 50%;
        top: 0;
        width: 10em;
        opacity: 0;
        transform: translateX(-75%);
        .board__cta.active & {
            opacity: 1;
        }
    }
    @media screen and (max-width: 700px){
        position: relative;
        z-index: 200;
        float: left;
        width: 65%;
        padding: 1rem;
        .board__cta:nth-child(odd) &{
            float: right;
        }
    }
}
.board__detail {
    @media screen and (min-width: 701px){
        position: absolute;
        top: 50%;
        left: 0;
        margin-left: 2em;
        transform: translateX(100%) translateY(-50%);
    }
    @media screen and (max-width: 700px){
        @for $i from 1 through 10 {
            [data-stat="#{$i}"]:before {
                @media screen and (max-width: 700px){
                    width: #{($i/10*100)*1%};
                }
            }
        }
    }
}
[class^="board__stat--"] {
    position: relative;
    width: 15em;
    margin-bottom: 1em;
    padding-left: .5em;
    color: #fff;
    transition: 200ms;
    @for $i from 1 through 4 {
        &:nth-child(#{$i}){
            &:before {
                transition-delay: ($i * 50ms);
            }
        }
    }
    @for $i from 1 through 2 {
        &:nth-child(#{$i}){
            &:before {
                background-color: #a7bfd4;
            }
        }
    }
    @for $i from 3 through 4 {
        &:nth-child(#{$i}){
            &:before {
                    background-color: #b22931;
            }
        }
    }
    &:before {
        content: "";
        position: absolute;
        z-index: -1;
        left: 0;
        top: 0;
        bottom: 0;
        width: 0;
        transition: 200ms;
    }
    &:after {
        content: attr(data-stat);
        position: absolute;
        right: -1em;
        color: #000;
    }
    @media screen and (min-width: 701px){
        .board__cta.active & {
            opacity: 1;
            transition: 300ms 300ms;
            @for $i from 1 through 10 {
                &[data-stat="#{$i}"]:before {
                    width: #{($i/10*100)*1%};
                }
            }
        }
    }
}
.btn {
    display: inline-block;
    background-color: #666;
    padding: .2em 1.5em;
    color: #fff;
    text-decoration: none;
    transition: background-color 300ms;
    &:hover {
        background-color: #000;
    }
}
footer {
    float: left;
    width: 100%;
    text-align: center;
    padding: 2em 0;
    font-style: italic;
    color: #ccc;
    a {
        color: #aaa;
    }
}

              
            
!

JS

              
                jQuery(function($){
    // cache the elements
    $wrap = $('.board__wrap');
    $cta = $wrap.find('.board__cta');
    $deck = $wrap.find('.board__deck');
    
    // on click of a cta
    $cta.on('click', function(e){
        // just trigger click on this cta
        e.stopPropagation();
        // cache this
        $this = $(this);
        // if the cta's not active then make it the only active cta
        if(!$this.hasClass('active')){
            $wrap
                .addClass('active');
            $cta
                .removeClass('active')
                .addClass('inactive');
            $this
                .removeClass('inactive')
                .addClass('active');
        // if the cta's active then close all active states
        } else {
            $cta.removeClass('active inactive');
            $wrap.removeClass('active');
        }
    });

    // on click of the ctas's container close all active states
    $wrap.on('click', function(){
        $cta.removeClass('active inactive');
        $wrap.removeClass('active');
    });
    
    // flip the board on click
    $deck.on('click', function(e){
        e.stopPropagation();
        $(this).toggleClass('active');
    });
    
    
    // for dev make the first one active (remove in production)
    $cta.eq(0).click();
});

              
            
!
999px

Console