测试1

var obj = $(".tip2-bx"),other = $(".enter"),time

function effect(){    

    var _this = this;
    this.other = other;
    this.obj = obj;

    other.hover(
        function(){
            _this.show($(this))
        },
        function(){
            _this.hide($(this))
        }
    )
    
    obj.hover(
        function(){
            clearTimeout(time)
        },
        function(){
            obj.css({"visibility":"hidden"})
        }
    )

}
    
effect.prototype = {
    show:function(o){
        clearTimeout(time)
        this.obj.css({"visibility":"visible","top":o.offset().top+20,"left":o.offset().left-35});    
    },
    
    hide:function(o){
        time = setTimeout(function(){this.obj.css({"visibility":"hidden"});},500)
    }
}
    
var n = new effect();
posted @ 2012-04-12 11:05  {前端开发}  阅读(129)  评论(0编辑  收藏  举报