我知道:animated选择器,但目前正在遇到旧IE的(可能是少数几个)性能问题(如图).我觉得这可能是我测试任何页面动画的方式.
目前我正在循环一段时间,核心测试正在进行$('*').is(':animated').这$('*')就是我所担心的......但是因为我不知道在我的插件下动画的div/etc是什么,我不知道怎么做!
var testAnimationInterval = setInterval(function () {
if ( ! $('*').is(':animated') ) { // all done animating
clearInterval(testAnimationInterval);
animationsFinished(); // callback function
}
}, 300);
function animationsFinished() {
// do whatever
}
Run Code Online (Sandbox Code Playgroud)
有人找到了更好/不同的方式吗?特别是在性能方面?
我$('[attribute]')用来选择html节点.当我使用节点时,很高兴知道选择了哪个html元素.
伪代码:
$('body').on('click', '[action]', function(){
var htmlElementName = this.name;
if(htmlElementName == 'form'){
return;
}
//do stuff
});
Run Code Online (Sandbox Code Playgroud)