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

              
                <body>
<div id="content" class="open">
    <div class="inner">
        <h3>Klik tombol di bawah untuk melihat efek transisi</h3>
        <p>Donec at dolor mi. Pellentesque sit amet ornare risus. Fusce varius ut turpis sed semper. In ut est et enim gravida interdum nec id quam. Aliquam leo ante, posuere id suscipit et, varius quis metus. Aenean tincidunt pellentesque facilisis.</p>
    </div>
</div>

<br />

<button class="button" id="toggle">Klik Disini</button>

</body>   
              
            
!

CSS

              
                .transitions {
    transition: all 0.5s ease-in-out;
    -webkit-transition: all 0.5s ease-in-out;
    -moz-transition: all 0.5s ease-in-out;
}

body {
    font-family:Arial;
    line-height: 3ex;
    background-color:#fff;
    font-size:16px
    color:#444;
}
#toggle {
    display:block;
    padding:10px;
    margin:10px auto;
    text-align:center;
    width:30ex;
}
#content {
    overflow:hidden;
    margin:10px;
    border:1px solid #bbb;
    background:#f0f0f0;
    opacity:1;
}
#content .inner {
    padding:10px;
    overflow:auto;
}
#content .inner h3{
    text-align:center;
}
.button{
    padding:10px 20px;
    margin:5px;
    color:#fff;
    text-align:center;
    border:0;
    cursor:pointer;
    border-radius:3px;
    display:block;
    text-decoration:none;
    font-weight:400;
    box-shadow:inset 0 -2px rgba(0,0,0,0.15);
    background:#e74c3c;
    transition:all 0.3s ease-in-out;
}
.button:hover{
    box-shadow:inset 0 -54px rgba(0,0,0,0.15);
    color:#fff;
}
.button:active{
    border:none;
    outline:none;
    box-shadow:none;
}
              
            
!

JS

              
                var content = $('#content');
content.inner = $('#content .inner');
content.on('transitionEnd webkitTransitionEnd transitionend oTransitionEnd msTransitionEnd', function(e){
    if(content.hasClass('open')){
        content.css('max-height', 9999);
    }
});

$('#toggle').on('click', function(e){
    content.toggleClass('open closed');
    content.contentHeight = content.outerHeight();
    
    if(content.hasClass('closed')){
        content.removeClass('transitions').css('max-height', content.contentHeight);
        setTimeout(function(){           
            content.addClass('transitions').css({
                'max-height': 0,
                'opacity': 0
            });
            
        }, 10);
        
    }else if(content.hasClass('open')){  
        
        content.contentHeight += content.inner.outerHeight();
        content.css({
            'max-height': content.contentHeight,
            'opacity': 1
        });
        
    }
});
              
            
!
999px

Console