LoginSignup
0
0

More than 3 years have passed since last update.

【JavaScript】スタイルシート

Last updated at Posted at 2019-06-01

javascriptでcss情報を取得する

スクリプト

var element = document.getElementById('box');
var style = (element.currentStyle || document.defaultView.getComputedStyle(element, ''));
style.width;

CSSアニメーション後のイベント

概要

jQueryで
CSSアニメーション終了後に
イベントを発火させたい場合

施策

(function($){
    $.fn.animateCallback = function(callback){
        var alias = "animationend webkitAnimationEnd oAnimationEnd MSAnimationEnd";

        return this.each(function() {
            var ua = navigator.userAgent;

            if(ua.indexOf('MSIE 9')!=-1){
                return callback.call(this);
            }else{
                $(this).bind(alias, function(){
                    $(this).unbind(alias);
                    return callback.call(this);
                });
            }
        });
    };
})(jQuery);

使用方法

$('div').animateCallback(function(){
    //CSSアニメーション終了後の処理
});
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0