/** * tools.tooltip "Slide Effect" 1.0.0 * * Copyright (c) 2009 Tero Piirainen * http://flowplayer.org/tools/tooltip.html#slide * * Dual licensed under MIT and GPL 2+ licenses * http://www.opensource.org/licenses * * Since : September 2009 * Date: ${date} * Revision: ${revision} */ (function($) { // version number var t = $.tools.tooltip; t.effects = t.effects || {}; t.effects.slide = {version: '1.0.0'}; // extend global configuragion with effect specific defaults $.extend(t.conf, { direction: 'up', // down, left, right bounce: false, slideOffset: 10, slideInSpeed: 200, slideOutSpeed: 200, slideFade: !$.browser.msie }); // directions for slide effect var dirs = { up: ['-', 'top'], down: ['+', 'top'], left: ['-', 'left'], right: ['+', 'left'] }; /* default effect: "slide" */ $.tools.tooltip.addEffect("slide", // show effect function(done) { // variables var conf = this.getConf(), tip = this.getTip(), params = conf.slideFade ? {opacity: conf.opacity} : {}, dir = dirs[conf.direction] || dirs.up; // direction params[dir[1]] = dir[0] +'='+ conf.slideOffset; // perform animation if (conf.slideFade) { tip.css({opacity:0}); } tip.show().animate(params, conf.slideInSpeed, done); }, // hide effect function(done) { // variables var conf = this.getConf(), offset = conf.slideOffset, params = conf.slideFade ? {opacity: 0} : {}, dir = dirs[conf.direction] || dirs.up; // direction var sign = "" + dir[0]; if (conf.bounce) { sign = sign == '+' ? '-' : '+'; } params[dir[1]] = sign +'='+ offset; // perform animation this.getTip().animate(params, conf.slideOutSpeed, function() { $(this).hide(); done.call(); }); } ); })(jQuery);