本文实例讲述了jQuery bt气泡实现悬停显示及移开隐藏功能的方法。分享给大家供大家参考,具体如下:
SEOver","click"],contentSelector:"$(this).next().html()",positions:["left","bottom"],fill:"#FFD97A",strokeWidth: 0,shadow: true,shadowOffsetX: 3,shadowOffsetY: 3,shadowBlur: 8,shadowColor: "rgba(0,.9)",shadowOverlap: false,noShadowOpts: {strokeStyle: "#999",strokeWidth: 2},});
var hideDelayTimer = null;
var hideDelayTimer2 = null;
$("div.bt-content").live("mouSEOver",function(e){
if (hideDelayTimer) clearTimeout(hideDelayTimer);
if (hideDelayTimer2) clearTimeout(hideDelayTimer2);
});
$("div.bt-content").live("mouSEOut",function(e){
if (hideDelayTimer) clearTimeout(hideDelayTimer);
hideDelayTimer2 = setTimeout(function(){
$("div.bt-wrapper").remove();
},100);
});
$("img.eq-message").mouSEOver(function(){
if (hideDelayTimer2) clearTimeout(hideDelayTimer2);
if (hideDelayTimer) clearTimeout(hideDelayTimer);
}).mouSEOut(function(){
hideDelayTimer = setTimeout(function(){
$("div.bt-wrapper").remove();
},100);
});
代码如下:
1&&opts.trigger[0]!=opts.trigger[1]){$(this).bind(opts.trigger[0],function(){this.btOn();}).bind(opts.trigger[1],function(){this.btOff();});}else{$(this).bind(opts.trigger[0],function(){if($(this).hasClass("bt-active")){this.btOff();}else{this.btOn();}});}}}}}this.btOn=function(){if(typeof $(this).data("bt-Box")=="object"){this.btOff();}opts.preBuild.apply(this);$(jQuery.bt.vars.closeWhenOpenStack).btOff();$(this).addClass("bt-active "+opts.activeClass);if(contentSelect&&opts.ajaxPath==null){if(opts.killTitle){$(this).attr("title",$(this).attr("bt-xTitle"));}content=$.isFunction(opts.contentSelector)?opts.contentSelector.apply(this):eval(opts.contentSelector);if(opts.killTitle){$(this).attr("title","");}}if(opts.ajaxPath!=null&&content==false){if(typeof opts.ajaxPath=="object"){var url=eval(opts.ajaxPath[0]);url+=opts.ajaxPath[1]?" "+opts.ajaxPath[1]:"";}else{var url=opts.ajaxPath;}var off=url.indexOf(" ");if(off>=0){var selector=url.slice(off,url.length);url=url.slice(0,off);}var cacheData=opts.ajaxCache?$(document.body).data("btCache-"+url.replace(/\./g,"")):null;if(typeof cacheData=="string"){content=selector?$("").append(cacheData.replace(/