css Audio - Active file-generic CSS - Active Generic - Active HTML - Active JS - Active SVG - Active Text - Active file-generic Video - Active header Love html icon-new-collection icon-person icon-team numbered-list123 pop-out spinner split-screen star tv

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.

+ add another resource

You're using npm packages, so we've auto-selected Babel for you here, which we require to process imports and make it all work. If you need to use a different JavaScript preprocessor, remove the packages in the npm tab.

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

Use npm Packages

We can make npm packages available for you to use in your JavaScript. We use webpack to prepare them and make them available to import. We'll also process your JavaScript with Babel.

⚠️ This feature can only be used by logged in users.

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.

HTML Settings

Here you can Sed posuere consectetur est at lobortis. Donec ullamcorper nulla non metus auctor fringilla. Maecenas sed diam eget risus varius blandit sit amet non magna. Donec id elit non mi porta gravida at eget metus. Praesent commodo cursus magna, vel scelerisque nisl consectetur et.

            
              

<button id="btnstart" class="btn">スタート</button>
<button id="btnreset" class="btn">リセット</button>
<div class="block">
    <h3>CSS transition(Event:transitionend)でアニメーションをつなぐ(IE10+)</h3>
<div id="anime1" class="box"><p>CSS transition: Scene1</p></div>
<div id="anime2" class="box"><p>CSS transition: Scene2</p></div>
<div id="anime3" class="box"><p>CSS transition: Scene3</p></div>
</div>
<hr>
<div class="block">
    <h3>$().animate()でアニメーションをつなぐ</h3>
<div id="anime4" class="box"><p>$().animate(): Scene2</p></div>
<div id="anime5" class="box"><p>$().animate(): Scene5</p></div>
<div id="anime6" class="box"><p>$().animate(): Scene6</p></div>
</div>
<hr>
<div class="block">
    <h3>$().velocity()でアニメーションをつなぐ (<a href="http://julian.com/research/velocity/">http://julian.com/research/velocity/</a>)</h3>
    <p>jQueryAnimateでは操作出来ないcolorも変更できる。</p>
<div id="anime7" class="box"><p>$().velocity(): Scene7</p></div>
<div id="anime8" class="box"><p>$().velocity(): Scene8</p></div>
<div id="anime9" class="box"><p>$().velocity(): Scene9</p></div>
    </div>
<ul>
    <li>CSSアニメーションの完了イベント(transitionend/MSTransitionEnd/webkitTransitionEnd/oTransitionEnd)は、<br>変更したCSSプロパティの個数の回数呼ばれる。<br>
        「margin,padding,color」を変更した場合は、3回イベントが発火する。<br>
        回避方法:<br>
        $("#xxx").off('transitionend MSTransitionEnd webkitTransitionEnd oTransitionEnd')してあげる。</li>
    <li>※CSS3を動的にはサワレナイ。<br>
        触る場合は、stepプロパティ($("#xxx").animate({....},{step:function(){...},dulation:1000}))を指定するか、<br>
        CSSで、transitionを指定しておき、$("#xxx").css({....})とでアニメーションさせる。</li>
</ul>

            
          
!
            
              .block{
        padding: 30px;
    }
    .btn{
        padding: 10px 20px;
    }
    .box{
        padding: 10px;
        width: 20%;
        height: 30px;
        margin-bottom: 5px;
        background-color: #CCCCCC;
        color:#000000;
    }
    #anime1,
    #anime2,
    #anime3{
    transition: all 1s ease;
    }

    #anime1.anime-start,
    #anime2.anime-start,
    #anime3.anime-start{
        width: 100%;
        color:#CC0000;
        background-color:#CC9999;
    }
            
          
!
            
                  $(function(){

        var TRANSITIONEND = "transitionend MSTransitionEnd webkitTransitionEnd oTransitionEnd";

        // Using Css Animation
        var afterAnime1 = function(){
            console.log('anime1-end');
            $("#anime1").off(TRANSITIONEND);
            $("#anime2").addClass("anime-start");
        };
        var afterAnime2 = function(){
            console.log('anime2-end');
            $("#anime2").off(TRANSITIONEND);
            $("#anime3").addClass("anime-start");
        };
        var afterAnime3 = function(){
            console.log('anime3-end');
            $("#anime3").off(TRANSITIONEND);
        };
        var cssanimesetting = function(){
            $("#anime1").on(TRANSITIONEND, afterAnime1);
            $("#anime2").on(TRANSITIONEND, afterAnime2);
            $("#anime3").on(TRANSITIONEND, afterAnime3);
        };
        cssanimesetting();


//        jQueryとVelocityで変更してみるCSSプロパティ
        var afterCssProperty = {
            'width' : '100%',
            'color' :'#CC0000',
            'background-color':'#CC9999'
        };

        // Using jQuery Animation
        var anime4 = function(){
            $("#anime4").animate(afterCssProperty,1000,'swing',anime5);
        };
        var anime5 = function(){
            $("#anime5").animate(afterCssProperty,1000,'swing',anime6);
        };
        var anime6 = function(){
            $("#anime6").animate(afterCssProperty,1000,'swing');
        };

        // Using velocity
        var anime7 = function(){
            $("#anime7").velocity(afterCssProperty,1000,'swing',anime8);
        };
        var anime8 = function(){
            $("#anime8").velocity(afterCssProperty,1000,'swing',anime9);
        };
        var anime9 = function(){
            $("#anime9").velocity(afterCssProperty,1000,'swing');
        };




//        実行
        $("#btnstart").click(function(){
            cssanimesetting();
            $("#anime1").addClass("anime-start");
            anime4();
            anime7();
        });
//        リセット
        $("#btnreset").click(function(){
            $('.box').removeClass('anime-start');
            $('.box').attr('style','');
        });

    });

            
          
!
999px
🕑 One or more of the npm packages you are using needs to be built. You're the first person to ever need it! We're building it right now and your preview will start updating again when it's ready.
Loading ..................

Console