• kissy


    <!DOCTYPE HTML>
    <html lang="en-US">
    <head>
        <meta charset="UTF-8">
        <title>拖放</title>
        <style type="text/css">
              .test1 {
                  position: absolute;
                  left:100px;
                  top:100px;
                  100px;height:20px;
                  background:grey;
              }
           .test2 {
                  position: absolute;
                  left:100px;
                  top:200px;
                  100px;height:20px;
                  background:red;
              }
    		         .test3 {
                  position: absolute;
                  left:200px;
                  top:300px;
                  200px;height:40px;
                  background:yellow;
              }
        </style>
    </head>
    <body>
    <script src="http://a.tbcdn.cn/s/kissy/1.3.0rc/seed-min.js"></script>
    <div id="t1">
        选择你要拖拽的按钮:
       <ul>
          <li><button class="test1" id="click-me">A</button></li>
          <li><button class="test2" id="click-me2">B</button></li>
        </ul>
    </div>
    
     
    <script type="text/javascript">
    KISSY.use('node',function(S,Node){
        Node.one('.test1').on('click',function(e){
    
    	KISSY.DOM.style('.test1', {position: 'absolute', top: '300px', left: '300px', '200px', height:'40px'});
        Node.one('.test1').html('Hello Kissy!');
    		
        });
    	
    	Node.one('.test2').on('click',function(e){
    	KISSY.DOM.style('.test1', {position: 'absolute', top: '100px', left: '100px', '100px', height:'20px'});
            Node.one('.test2').html('Hello Kissy!');
        });
    });
        KISSY.use("dd",function(S,DD){
    	
            var drag=new DD.Draggable({
                node:'.test1',
                cursor:'move',
                move:true
            });
            var drag2=new DD.Draggable({
                node:'.test2',
                cursor:'move',
                move:true
            });
            //使当前拖放对象具备代理功能.
            new DD.Proxy().attach(drag);
            new DD.Proxy().attach(drag2);
            var c = new DD.Constrain({
                constrain: true
            });
            //限制拖放元素的范围为可视窗口区域
            c.attachDrag(drag);
             c.attachDrag(drag2);
        });
    </script>
    </body>
    </html>
    

      

  • 相关阅读:
    ExceptionExtensions
    implicit operator
    javascript Demo
    KO Demo
    Model Binding
    Await Async Task
    STL查找序列中处于某一大小范围内的元素个数
    2017头条笔试题:二维点集中找出右上角没有点的点并按x坐标从小到大打印坐标
    VS2017新建windows控制台程序打印中文乱码问题
    【详解】Linux的文件描述符fd与文件指针FILE*互相转换
  • 原文地址:https://www.cnblogs.com/victorruan/p/3835790.html
Copyright © 2020-2023  润新知