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アニメーション終了後の処理
});