(function($){ $.fn.floatqq=function(o) { o=typeof(o)=="object"?o:{}; var qq=$(this); qq.css({position:"absolute",zindex:1000,left:$(window).width()-140}); o.top=parseint(o.top); o.bottom=parseint(o.bottom); o.x=o.x||qq.position().left; o.ishide=qq.position().left<0?true:false; o.h=qq.height(); function qqdoset() { if(qqdoset.doset) {cleartimeout(qqdoset.doset)} qqdoset.doset=settimeout(qqposet,50); } function qqposet() { var scrolltop=$(document).scrolltop(); var winheight=$(window).height(); //自动居中 var _top=o.bottom?parseint(winheight+scrolltop-o.bottom-o.h+20)+"px":parseint(scrolltop+(o.top||(winheight/2 - o.h/2))+20)+"px"; //固定高度 //var _top=scrolltop+100; qq.stop(true,false) .animate({top:_top},{duration:o.duration||2200,easing:o.easing||"elasout"}); if(o.type) {qq.click(qqshow)} else {qq.hover(qqshow,qqshow)} } function qqshow() { if(qq.show) {cleartimeout(qq.timeoout)} qq.show=settimeout(function(){qq.stop(true,false).animate({},{easing:"easeout"})},50) } function getpos() { o.ishide=o.ishide?false:true; return o.ishide?o.x:0; } function qqini() { qqdoset(); $(window).scroll(qqdoset); } qqini(); return this; } })(jquery)