jquery实现任意元素拖动放大缩小效果

代码语言:html

所属分类:拖放

下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开

<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>BFW NEW PAGE</title>
    <script id="bfwone" data="dep=jquery.17&err=0" type="text/javascript" src="http://repo.bfw.wiki/bfwrepo/js/bfwone.js"></script>
    <script type="text/javascript">
        bready(function() {
            $(document).mousemove(function(e) {
                if (!!this.move) {
                    var posix=!document.move_target? {
                        'x': 0,
                        'y': 0
                    }: document.move_target.posix,
                    callback = document.call_down || function() {
                        $(this.move_target).css({
                            'top': e.pageY-posix.y, 'left': e.pageX-posix.x
                        });
                    }; 
                    callback.call(this, e, posix);
                }}).mouseup(function(e) {
                if (!!this.move) {
                    var callback = document.call_up || function() {}; callback.call(this, e); $.extend(this, {
                        'move': false, 'move_target': null, 'call_down': false, 'call_up': false
                    });
                }});
            var $box = $('#box').mousedown(function(e) {
                var offset = $(this).offset(); this.posix = {
                    'x': e.pageX-offset.left,
                    'y': e.pageY-offset.top
                }; $.extend(document, {
                        'move': true, 'move_target': this
.........完整代码请登录后点击上方下载按钮下载查看

网友评论0