3525bee201b4029e66211d1e3fa794e0a66c0b47
[atutor.git] / docs / jscripts / infusion / components / tooltip / js / Tooltip.js
1 var fluid_1_4=fluid_1_4||{};(function($,fluid){var createContentFunc=function(content){return typeof content==="function"?content:function(){return content}};var setup=function(that){that.container.tooltip({content:createContentFunc(that.options.content),position:that.options.position,items:that.options.items,open:function(event){var tt=$(event.target).tooltip("widget");tt.stop(false,true);tt.hide();if(that.options.delay){tt.delay(that.options.delay).fadeIn("default",that.events.afterOpen.fire())}else{tt.show();that.events.afterOpen.fire()}},close:function(event){var tt=$(event.target).tooltip("widget");tt.stop(false,true);tt.hide();tt.clearQueue();that.events.afterClose.fire()}});that.elm=that.container.tooltip("widget");that.elm.addClass(that.options.styles.tooltip)};fluid.tooltip=function(container,options){var that=fluid.initView("fluid.tooltip",container,options);that.updateContent=function(content){that.container.tooltip("option","content",createContentFunc(content))};that.destroy=function(){that.container.tooltip("destroy")};that.open=function(){that.container.tooltip("open")};that.close=function(){that.container.tooltip("close")};setup(that);return that};fluid.defaults("fluid.tooltip",{styles:{tooltip:""},events:{afterOpen:null,afterClose:null},content:"",position:{my:"left top",at:"left bottom",offset:"0 5"},items:"*",delay:300})})(jQuery,fluid_1_4);