---
title: "【原创】jquery drage 插件"
author: "demojava"
date: "2012-04-10T10:37:20Z"
tags: []
categories: ["Web前端"]
slug: "jquery-drage"
draft: false
lastmod: "2012-04-10T10:37:11Z"
id: 1481491
url: "https://demojava.iteye.com/blog/1481491"
---

一个jquery drag 的插件

[http://www.onextrapixel.com/examples/drag-and-drop-technique/drag-and-drop-technique.zip](http://www.onextrapixel.com/examples/drag-and-drop-technique/drag-and-drop-technique.zip)

这个太烂了。笔者测试发现。这个jquery 插件核心库 用jquery是1.3的版本当使用 jquery 1.4 core.js或者1.7.1.js发现官网的demo不动了。。什么反映也没有。一看代码做的挺不错的。就是代码多了写。

自己动手写一个吧。

![](http://dl.iteye.com/upload/attachment/0066/2923/ddb227a4-883c-3273-ab2b-9e84f907f56b.png)

css 使用的是 上面提供

支持 拖拽区域控制。轻量级插件4.07 KB

 

Demo 使用

 

 

```
$(document).ready( function(){
 $("#panel").drags({areaTo:"demo1",titleId:"panelTilte",enable:true,context:"panelContext",zIndex:"20"});
}); 

```

 

参数说明：

areaTo:控制拖拽区域dom id

 titleId:标题栏

enable:是否启用拖拽

context:内容面板对应的dom id

zIndex:dom 对应的 z-index

```
<!--模块拖拽-->
<div id="panel" class="dv1" >
    <h2 id="panelTilte" class="handler">Drag me</h2>
    <div id="panelContext" class="content">Yes, it is.</div>
</div>
```

 

 源码参见附件：

 

有bug 联系我 站内消息 email:fsm@test163.com