2015-02-23 60 views
-1

我正在通过Cordova制作一个模拟一页原生应用程序的iOS应用程序。“Div装载”CSS动画

我使用的是PageTransitions.js,它使用div作为整页(类似于jQuery手机)来模拟平滑的页面转换。有了它,我使用jQuery onClick函数来激发css动画。

我的问题是:有没有办法延迟css动画播放,直到设备侧重于它们所在的div?我想在div负载上播放这些动画,为图层提供图层,而不是像静态网页。

回答

0

很容易;没有你的代码我只是想提供一些伪代码。

对于你的CSS:

#some-id.active .some-class { 
    /*do some animation or other */ 
} 

,做一个javascript是这样的:

// depending on your situation and other scripts you are using 
// you'll probably want to wrap it jQuery closure to make sure 
// that $ is jQuery. 
$(document).ready(function(){ 
    $('#some-id').onClick(function() { 
    $(this).addClass('active'); // depending on setup you may want to remove this from other selectors when adding it to the current one. 
    } 
}