ne1 /*!2 * jQuery UI Effects Fold @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/Fold9 *10 * Depends:11 * jquery.effects.core.js12 */13 (function( $, undefined ) {1415 $.effects.fold = 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 || 'hide'); // Set Mode24 var size = o.options.size || 15; // Default fold size25 var horizFirst = !(!o.options.horizFirst); // Ensure a boolean value26 var duration = o.duration ? o.duration / 2 : $.fx.speeds._default / 2;2728 // Adjust29 $.effects.save(el, props); el.show(); // Save & Show30 var wrapper = $.effects.createWrapper(el).css({overflow:'hidden'}); // Create Wrapper31 var widthFirst = ((mode == 'show') != horizFirst);32 var ref = widthFirst ? ['width', 'height'] : ['height', 'width'];33 var distance = widthFirst ? [wrapper.width(), wrapper.height()] : [wrapper.height(), wrapper.width()];34 var percent = /([0-9]+)%/.exec(size);35 if(percent) size = parseInt(percent[1],10) / 100 * distance[mode == 'hide' ? 0 : 1];36 if(mode == 'show') wrapper.css(horizFirst ? {height: 0, width: size} : {height: size, width: 0}); // Shift3738 // Animation39 var animation1 = {}, animation2 = {};40 animation1[ref[0]] = mode == 'show' ? distance[0] : size;41 animation2[ref[1]] = mode == 'show' ? distance[1] : 0;4243 // Animate44 wrapper.animate(animation1, duration, o.options.easing)45 .animate(animation2, duration, o.options.easing, function() {46 if(mode == 'hide') el.hide(); // Hide47 $.effects.restore(el, props); $.effects.removeWrapper(el); // Restore48 if(o.callback) o.callback.apply(el[0], arguments); // Callback49 el.dequeue();50 });5152 });5354 };5556 })(jQuery);ne 1 /*! 2 * jQuery UI Effects Fold @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/Fold 9 * 10 * Depends: 11 * jquery.effects.core.js 12 */ 13 (function( $, undefined ) { 14 15 $.effects.fold = 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 || 'hide'); // Set Mode 24 var size = o.options.size || 15; // Default fold size 25 var horizFirst = !(!o.options.horizFirst); // Ensure a boolean value 26 var duration = o.duration ? o.duration / 2 : $.fx.speeds._default / 2; 27 28 // Adjust 29 $.effects.save(el, props); el.show(); // Save & Show 30 var wrapper = $.effects.createWrapper(el).css({overflow:'hidden'}); // Create Wrapper 31 var widthFirst = ((mode == 'show') != horizFirst); 32 var ref = widthFirst ? ['width', 'height'] : ['height', 'width']; 33 var distance = widthFirst ? [wrapper.width(), wrapper.height()] : [wrapper.height(), wrapper.width()]; 34 var percent = /([0-9]+)%/.exec(size); 35 if(percent) size = parseInt(percent[1],10) / 100 * distance[mode == 'hide' ? 0 : 1]; 36 if(mode == 'show') wrapper.css(horizFirst ? {height: 0, width: size} : {height: size, width: 0}); // Shift 37 38 // Animation 39 var animation1 = {}, animation2 = {}; 40 animation1[ref[0]] = mode == 'show' ? distance[0] : size; 41 animation2[ref[1]] = mode == 'show' ? distance[1] : 0; 42 43 // Animate 44 wrapper.animate(animation1, duration, o.options.easing) 45 .animate(animation2, duration, o.options.easing, function() { 46 if(mode == 'hide') el.hide(); // Hide 47 $.effects.restore(el, props); $.effects.removeWrapper(el); // Restore 48 if(o.callback) o.callback.apply(el[0], arguments); // Callback 49 el.dequeue(); 50 }); 51 52 }); 53 54 }; 55 56 })(jQuery);ne 1 /*! 2 * jQuery UI Effects Fold @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/Fold 9 * 10 * Depends: 11 * jquery.effects.core.js 12 */ 13 (function( $, undefined ) { 14 15 $.effects.fold = 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 || 'hide'); // Set Mode 24 var size = o.options.size || 15; // Default fold size 25 var horizFirst = !(!o.options.horizFirst); // Ensure a boolean value 26 var duration = o.duration ? o.duration / 2 : $.fx.speeds._default / 2; 27 28 // Adjust 29 $.effects.save(el, props); el.show(); // Save & Show 30 var wrapper = $.effects.createWrapper(el).css({overflow:'hidden'}); // Create Wrapper 31 var widthFirst = ((mode == 'show') != horizFirst); 32 var ref = widthFirst ? ['width', 'height'] : ['height', 'width']; 33 var distance = widthFirst ? [wrapper.width(), wrapper.height()] : [wrapper.height(), wrapper.width()]; 34 var percent = /([0-9]+)%/.exec(size); 35 if(percent) size = parseInt(percent[1],10) / 100 * distance[mode == 'hide' ? 0 : 1]; 36 if(mode == 'show') wrapper.css(horizFirst ? {height: 0, width: size} : {height: size, width: 0}); // Shift 37 38 // Animation 39 var animation1 = {}, animation2 = {}; 40 animation1[ref[0]] = mode == 'show' ? distance[0] : size; 41 animation2[ref[1]] = mode == 'show' ? distance[1] : 0; 42 43 // Animate 44 wrapper.animate(animation1, duration, o.options.easing) 45 .animate(animation2, duration, o.options.easing, function() { 46 if(mode == 'hide') el.hide(); // Hide 47 $.effects.restore(el, props); $.effects.removeWrapper(el); // Restore 48 if(o.callback) o.callback.apply(el[0], arguments); // Callback 49 el.dequeue(); 50 }); 51 52 }); 53 54 }; 55 56 })(jQuery);
© Reprint statement
This article was written by Harry
Link to this article:https://www.361sale.com/en/13247
The article is copyrighted and must be reproduced with attribution.
THE END
No comments