当前位置: 代码迷 >> Web前端 >> 一月13日
  详细解决方案

一月13日

热度:205   发布时间:2012-11-22 00:16:41.0
1月13日

jquery之窗口拖动:

?

$('#inner').mousedown(function(event){
???var offset = $(this).offset();
???_x=event.clientX-offset.left;
???_y=event.clientY-offset.top;
???$('#out').css({'top':offset.top+'px'});
???$('#out').mousemove(function(event){
???var temp = $("#out");
???_xx=event.clientX-_x;
???_yy=event.clientY-_y;
???temp.css({left:_xx,top:_yy});
//???this.style.left=_xx;
//???this.style.top=_yy;
???this.style.zIndex=100;//这里的this是指向哪的
???return false;//方法执行完后返回false最好
???});
???return false;
});
$("#out").mouseup(function(){

$(this).unbind("mousemove");

$(this).css({'z-index':'-1'});

return false;

});

  相关解决方案