[9188] | 1 | /* |
---|
| 2 | |
---|
| 3 | _/ _/_/ _/_/_/_/_/ _/ |
---|
| 4 | _/ _/ _/ _/_/ _/ _/ _/_/_/ _/_/_/ |
---|
| 5 | _/ _/ _/_/ _/ _/ _/ _/ _/ _/ _/ _/ |
---|
| 6 | _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ |
---|
| 7 | _/ _/_/ _/ _/ _/_/ _/_/_/ _/_/_/ _/ _/ |
---|
| 8 | _/ |
---|
| 9 | _/ |
---|
| 10 | |
---|
| 11 | Created by David Kaneda <http://www.davidkaneda.com> |
---|
| 12 | Documentation and issue tracking on Google Code <http://code.google.com/p/jqtouch/> |
---|
| 13 | |
---|
| 14 | Special thanks to Jonathan Stark <http://jonathanstark.com/> |
---|
| 15 | and pinch/zoom <http://www.pinchzoom.com/> |
---|
| 16 | |
---|
| 17 | (c) 2009 by jQTouch project members. |
---|
| 18 | See LICENSE.txt for license. |
---|
| 19 | |
---|
| 20 | */ |
---|
| 21 | |
---|
| 22 | (function($) { |
---|
| 23 | |
---|
| 24 | $.fn.transition = function(css, options) { |
---|
| 25 | return this.each(function(){ |
---|
| 26 | var $el = $(this); |
---|
| 27 | var defaults = { |
---|
| 28 | speed : '300ms', |
---|
| 29 | callback: null, |
---|
| 30 | ease: 'ease-in-out' |
---|
| 31 | }; |
---|
| 32 | var settings = $.extend({}, defaults, options); |
---|
| 33 | if(settings.speed === 0) { |
---|
| 34 | $el.css(css); |
---|
| 35 | window.setTimeout(settings.callback, 0); |
---|
| 36 | } else { |
---|
| 37 | if ($.browser.safari) |
---|
| 38 | { |
---|
| 39 | var s = []; |
---|
| 40 | for(var i in css) { |
---|
| 41 | s.push(i); |
---|
| 42 | } |
---|
| 43 | $el.css({ |
---|
| 44 | webkitTransitionProperty: s.join(", "), |
---|
| 45 | webkitTransitionDuration: settings.speed, |
---|
| 46 | webkitTransitionTimingFunction: settings.ease |
---|
| 47 | }); |
---|
| 48 | if (settings.callback) { |
---|
| 49 | $el.one('webkitTransitionEnd', settings.callback); |
---|
| 50 | } |
---|
| 51 | setTimeout(function(el){ el.css(css) }, 0, $el); |
---|
| 52 | } |
---|
| 53 | else |
---|
| 54 | { |
---|
| 55 | $el.animate(css, settings.speed, settings.callback); |
---|
| 56 | } |
---|
| 57 | } |
---|
| 58 | }); |
---|
| 59 | } |
---|
| 60 | })(jQuery); |
---|