jquery--ppDrag

ppDrag is a Drag&Drop plugin for jQuery, which mimics the interface of jQuery UI's Draggable. Currently supported is a small subset of its options, but the implementation is different (ppDrag focuses on performance). Drag the two boxes below while watching your CPU usage to see the differences in their speed:

The speed difference is more visible with slower CPU's. If you have a fast processor which supports SpeedStep or a similar technology, you can try lowering its frequency. Also, due to JavaScript engine optimizations in the last generation browsers, the speed difference is less than with older browsers. For example, it is greater with Firefox 2 than with Firefox 3.

All major existing browsers are supported. This includes IE6/7, Firefox1/2/3, Opera, Konqueror, Safari, and probably others.

Download:
ppDrag is licensed under the LGPL license

Latest version (0.2): jquery.ppdrag.js
All downloads: http://code.google.com/p/ppdrag/downloads/list
Subversion: http://code.google.com/p/ppdrag/source/checkout

Usage:
Include jQuery:
<script src="jquery.js" type="text/javascript"></script>
Include ppDrag:
<script src="jquery.ppdrag.js" type="text/javascript"></script>
Activate ppDrag. Example:
$(document).ready(function() {
$("#element1").ppdrag();
});

Note: at the moment ppDrag doesn't support elements with static positioning. Please use either relative, absolute, or fixed positioning.
(optional) Specify options. Example:
$(document).ready(function() {
$("#element2").ppdrag({ zIndex: 1000 });
});

(optional) When no longer needed, you can deactivate ppDrag. Example:
$("#element2").ppdrag("destroy");

Supported options:
zIndex: [integer] z-index for the element while being dragged.
stop: [function(element)] Function that gets called when dragging stops.
History:
Version 0.1 (2008-04-03):
Initial release
Version 0.2 (2008-08-26):
Fixed cancelling IE's default event action didn't work;
Callbacks (only 'stop' for now) receive the element both as 'this' and as an argument, just like jQuery UI Draggable;
Updated jQuery UI version used in this demo to 1.5.2. It has received many optimizations and is now signifficantly faster than before (though still not as fast as ppDrag);
ToDo:
Seems like IE's default actions are not prevented properly while handling mouse events. Investigate and fix.
Add support for start and drag callbacks
Add explicit support for static-positioned elements (currently supported are absolute, relative, fixed)
Add support for more of jQuery UI Draggable's options
(possibly) Add Droppables
Contact:
Copyright (c) 2008, Peter Petrov
The author can be contacted at email: ppetrov(at)ppetrov.com

Bugs and feature requests should be reported at the issue tracker.
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值