jQuery制作拼图小游戏

2020-05-24 21:18:48易采站长站整理

                        if($(this).hasClass(“on”)){
                            t = true;
                        }
                    });
                    return t;
                };
            // click
            $div.click(function(){
                var $this = $(this);   
                if(hasElem()&&!$this.hasClass(“on”)){
                    var index = $(‘.on’).index();
                    if($div.eq(index).is(‘:animated’)||$this.is(‘:animated’)){
                        return false;
                    }
                    var l = $div.eq(index).position().left,
                        t = $div.eq(index).position().top,
                        myl = $this.position().left,
                        myt = $this.position().top;
                    $(this).animate({‘left’:l,’top’:t});
                    $div.eq(index).css({‘z-index’:’1′}).animate({‘left’:myl,’top’:myt},function(){