Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var blocking = false;
- alert(Animate.whichTransition);
- document.getElementById('click').onclick = function(e) {
- if (blocking) {
- return false;
- }
- blocking = true;
- var that = this,
- el = document.getElementById('test'),
- from = (this.className == 'animated') ? 1 : 0,
- to = from == 1 ? 0 : 1;
- // relevant stuffs
- if (Animate.canTransition) {
- switch (Animate.whichTransition) {
- case 'webkit':
- console.log('WebKit Vendor Prefix');
- el.style.WebkitTransition = 'opacity 0.5s ease-out';
- break;
- case 'mozilla':
- console.log('Mozilla Vendor Prefix');
- el.style.MozTransition = 'opacity 0.5s ease-out';
- break;
- case 'opera':
- console.log('Opera Vendor Prefix');
- el.style.OTransition = 'opacity 0.5s ease-out';
- break;
- default:
- console.log('W3C Standard Compliant Browser');
- el.style.transition = 'opacity 0.5s ease-out';
- break;
- }
- el.style.opacity = to;
- blocking = false;
- that.className = (that.className == 'animated') ? '' : 'animated';
- } else {
- new Animate(el, 'opacity', {
- from: from,
- to: to,
- time: 500,
- callback: function() {
- that.className = (that.className == 'animated') ? '' : 'animated';
- blocking = false;
- }
- }).start();
- }
- return false;
- }};
Add Comment
Please, Sign In to add comment