1 /*!2 * jQuery UI Effects Bounce @VERSION3 *4 * Copyright 2012, AUTHORS.txt (http://jqueryui.com/about)5 * Dual licensed under the MIT or GPL Version 2 licenses.6 * http://jquery.org/license7 *8 * http://docs.jquery.com/UI/Effects/Bounce9 *10 * Depends:11 * jquery.effects.core.js12 */13 (function( $, undefined ) {1415 $.effects.bounce = function(o) {1617 return this.queue(function() {1819 // Create element20 var el = $(this), props = ['position','top','bottom','left','right'];2122 // Set options23 var mode = $.effects.setMode(el, o.options.mode || 'effect'); // Set Mode24 var direction = o.options.direction || 'up'; // Default direction25 var distance = o.options.distance || 20; // Default distance26 var times = o.options.times || 5; // Default # of times27 var speed = o.duration || 250; // Default speed per bounce28 if (/show|hide/.test(mode)) props.push('opacity'); // Avoid touching opacity to prevent clearType and PNG issues in IE2930 // Adjust31 $.effects.save(el, props); el.show(); // Save & Show32 $.effects.createWrapper(el); // Create Wrapper33 var ref = (direction == 'up' || direction == 'down') ? 'top' : 'left';34 var motion = (direction == 'up' || direction == 'left') ? 'pos' : 'neg';35 var distance = o.options.distance || (ref == 'top' ? el.outerHeight({margin:true}) / 3 : el.outerWidth({margin:true}) / 3);36 if (mode == 'show') el.css('opacity', 0).css(ref, motion == 'pos' ? -distance : distance); // Shift37 if (mode == 'hide') distance = distance / (times * 2);38 if (mode != 'hide') times--;3940 // Animate41 if (mode == 'show') { // Show Bounce42 var animation = {opacity: 1};43 animation[ref] = (motion == 'pos' ? '+=' : '-=') + distance;44 el.animate(animation, speed / 2, o.options.easing);45 distance = distance / 2;46 times--;47 };48 for (var i = 0; i < times; i++) { // Bounces49 var animation1 = {}, animation2 = {};50 animation1[ref] = (motion == 'pos' ? '-=' : '+=') + distance;51 animation2[ref] = (motion == 'pos' ? '+=' : '-=') + distance;52 el.animate(animation1, speed / 2, o.options.easing).animate(animation2, speed / 2, o.options.easing);53 distance = (mode == 'hide') ? distance * 2 : distance / 2;54 };55 if (mode == 'hide') { // Last Bounce56 var animation = {opacity: 0};57 animation[ref] = (motion == 'pos' ? '-=' : '+=') + distance;58 el.animate(animation, speed / 2, o.options.easing, function(){59 el.hide(); // Hide60 $.effects.restore(el, props); $.effects.removeWrapper(el); // Restore61 if(o.callback) o.callback.apply(this, arguments); // Callback62 });63 } else {64 var animation1 = {}, animation2 = {};65 animation1[ref] = (motion == 'pos' ? '-=' : '+=') + distance;66 animation2[ref] = (motion == 'pos' ? '+=' : '-=') + distance;67 el.animate(animation1, speed / 2, o.options.easing).animate(animation2, speed / 2, o.options.easing, function(){68 $.effects.restore(el, props); $.effects.removeWrapper(el); // Restore69 if(o.callback) o.callback.apply(this, arguments); // Callback70 });71 };72 el.queue('fx', function() { el.dequeue(); });73 el.dequeue();74 });7576 };7778 })(jQuery);1 /*! 2 * jQuery UI Effects Bounce @VERSION 3 * 4 * Copyright 2012, AUTHORS.txt (http://jqueryui.com/about) 5 * Dual licensed under the MIT or GPL Version 2 licenses. 6 * http://jquery.org/license 7 * 8 * http://docs.jquery.com/UI/Effects/Bounce 9 * 10 * Depends: 11 * jquery.effects.core.js 12 */ 13 (function( $, undefined ) { 14 15 $.effects.bounce = function(o) { 16 17 return this.queue(function() { 18 19 // Create element 20 var el = $(this), props = ['position','top','bottom','left','right']; 21 22 // Set options 23 var mode = $.effects.setMode(el, o.options.mode || 'effect'); // Set Mode 24 var direction = o.options.direction || 'up'; // Default direction 25 var distance = o.options.distance || 20; // Default distance 26 var times = o.options.times || 5; // Default # of times 27 var speed = o.duration || 250; // Default speed per bounce 28 if (/show|hide/.test(mode)) props.push('opacity'); // Avoid touching opacity to prevent clearType and PNG issues in IE 29 30 // Adjust 31 $.effects.save(el, props); el.show(); // Save & Show 32 $.effects.createWrapper(el); // Create Wrapper 33 var ref = (direction == 'up' || direction == 'down') ? 'top' : 'left'; 34 var motion = (direction == 'up' || direction == 'left') ? 'pos' : 'neg'; 35 var distance = o.options.distance || (ref == 'top' ? el.outerHeight({margin:true}) / 3 : el.outerWidth({margin:true}) / 3); 36 if (mode == 'show') el.css('opacity', 0).css(ref, motion == 'pos' ? -distance : distance); // Shift 37 if (mode == 'hide') distance = distance / (times * 2); 38 if (mode != 'hide') times--; 39 40 // Animate 41 if (mode == 'show') { // Show Bounce 42 var animation = {opacity: 1}; 43 animation[ref] = (motion == 'pos' ? '+=' : '-=') + distance; 44 el.animate(animation, speed / 2, o.options.easing); 45 distance = distance / 2; 46 times--; 47 }; 48 for (var i = 0; i < times; i++) { // Bounces 49 var animation1 = {}, animation2 = {}; 50 animation1[ref] = (motion == 'pos' ? '-=' : '+=') + distance; 51 animation2[ref] = (motion == 'pos' ? '+=' : '-=') + distance; 52 el.animate(animation1, speed / 2, o.options.easing).animate(animation2, speed / 2, o.options.easing); 53 distance = (mode == 'hide') ? distance * 2 : distance / 2; 54 }; 55 if (mode == 'hide') { // Last Bounce 56 var animation = {opacity: 0}; 57 animation[ref] = (motion == 'pos' ? '-=' : '+=') + distance; 58 el.animate(animation, speed / 2, o.options.easing, function(){ 59 el.hide(); // Hide 60 $.effects.restore(el, props); $.effects.removeWrapper(el); // Restore 61 if(o.callback) o.callback.apply(this, arguments); // Callback 62 }); 63 } else { 64 var animation1 = {}, animation2 = {}; 65 animation1[ref] = (motion == 'pos' ? '-=' : '+=') + distance; 66 animation2[ref] = (motion == 'pos' ? '+=' : '-=') + distance; 67 el.animate(animation1, speed / 2, o.options.easing).animate(animation2, speed / 2, o.options.easing, function(){ 68 $.effects.restore(el, props); $.effects.removeWrapper(el); // Restore 69 if(o.callback) o.callback.apply(this, arguments); // Callback 70 }); 71 }; 72 el.queue('fx', function() { el.dequeue(); }); 73 el.dequeue(); 74 }); 75 76 }; 77 78 })(jQuery);1 /*! 2 * jQuery UI Effects Bounce @VERSION 3 * 4 * Copyright 2012, AUTHORS.txt (http://jqueryui.com/about) 5 * Dual licensed under the MIT or GPL Version 2 licenses. 6 * http://jquery.org/license 7 * 8 * http://docs.jquery.com/UI/Effects/Bounce 9 * 10 * Depends: 11 * jquery.effects.core.js 12 */ 13 (function( $, undefined ) { 14 15 $.effects.bounce = function(o) { 16 17 return this.queue(function() { 18 19 // Create element 20 var el = $(this), props = ['position','top','bottom','left','right']; 21 22 // Set options 23 var mode = $.effects.setMode(el, o.options.mode || 'effect'); // Set Mode 24 var direction = o.options.direction || 'up'; // Default direction 25 var distance = o.options.distance || 20; // Default distance 26 var times = o.options.times || 5; // Default # of times 27 var speed = o.duration || 250; // Default speed per bounce 28 if (/show|hide/.test(mode)) props.push('opacity'); // Avoid touching opacity to prevent clearType and PNG issues in IE 29 30 // Adjust 31 $.effects.save(el, props); el.show(); // Save & Show 32 $.effects.createWrapper(el); // Create Wrapper 33 var ref = (direction == 'up' || direction == 'down') ? 'top' : 'left'; 34 var motion = (direction == 'up' || direction == 'left') ? 'pos' : 'neg'; 35 var distance = o.options.distance || (ref == 'top' ? el.outerHeight({margin:true}) / 3 : el.outerWidth({margin:true}) / 3); 36 if (mode == 'show') el.css('opacity', 0).css(ref, motion == 'pos' ? -distance : distance); // Shift 37 if (mode == 'hide') distance = distance / (times * 2); 38 if (mode != 'hide') times--; 39 40 // Animate 41 if (mode == 'show') { // Show Bounce 42 var animation = {opacity: 1}; 43 animation[ref] = (motion == 'pos' ? '+=' : '-=') + distance; 44 el.animate(animation, speed / 2, o.options.easing); 45 distance = distance / 2; 46 times--; 47 }; 48 for (var i = 0; i < times; i++) { // Bounces 49 var animation1 = {}, animation2 = {}; 50 animation1[ref] = (motion == 'pos' ? '-=' : '+=') + distance; 51 animation2[ref] = (motion == 'pos' ? '+=' : '-=') + distance; 52 el.animate(animation1, speed / 2, o.options.easing).animate(animation2, speed / 2, o.options.easing); 53 distance = (mode == 'hide') ? distance * 2 : distance / 2; 54 }; 55 if (mode == 'hide') { // Last Bounce 56 var animation = {opacity: 0}; 57 animation[ref] = (motion == 'pos' ? '-=' : '+=') + distance; 58 el.animate(animation, speed / 2, o.options.easing, function(){ 59 el.hide(); // Hide 60 $.effects.restore(el, props); $.effects.removeWrapper(el); // Restore 61 if(o.callback) o.callback.apply(this, arguments); // Callback 62 }); 63 } else { 64 var animation1 = {}, animation2 = {}; 65 animation1[ref] = (motion == 'pos' ? '-=' : '+=') + distance; 66 animation2[ref] = (motion == 'pos' ? '+=' : '-=') + distance; 67 el.animate(animation1, speed / 2, o.options.easing).animate(animation2, speed / 2, o.options.easing, function(){ 68 $.effects.restore(el, props); $.effects.removeWrapper(el); // Restore 69 if(o.callback) o.callback.apply(this, arguments); // Callback 70 }); 71 }; 72 el.queue('fx', function() { el.dequeue(); }); 73 el.dequeue(); 74 }); 75 76 }; 77 78 })(jQuery);
联系我们 |
---|
文章看不懂?联系我们为您免费解答!免费助力个人,小企站点! |
① 电话:020-2206-9892 |
② QQ咨询:1025174874 |
③ 邮件:info@361sale.com |
④ 工作时间:周一至周五,9:30-18:30,节假日休息 |
THE END
暂无评论内容