`
stworthy
  • 浏览: 522504 次
  • 来自: ...
社区版块
存档分类
最新评论

jquery-easyui中实现课程表拖放效果

阅读更多

利用jQuery EasyUI可以很容易就实现学校课程表的拖放设计,看一下效果图:

如何将左边的课程拖到右边的单元格上,利用draggable,droppable二个插件就可以做到。

看一下课程表的HTML结构:

<div class="left">
    <table>
        <tr>
            <td><div class="item">English</div></td>
        </tr>
        <tr>
            <td><div class="item">Science</div></td>
        </tr>
        <!-- other subjects -->
    </table>
</div>

再看一下时间表的HTML结构:

<div class="right">
    <table>
        <tr>
            <td class="blank"></td>
            <td class="title">Monday</td>
            <td class="title">Tuesday</td>
            <td class="title">Wednesday</td>
            <td class="title">Thursday</td>
            <td class="title">Friday</td>
        </tr>
        <tr>
            <td class="time">08:00</td>
            <td class="drop"></td>
            <td class="drop"></td>
            <td class="drop"></td>
            <td class="drop"></td>
            <td class="drop"></td>
        </tr>
        <!-- other cells -->
    </table>
</div>

现在可以看拖放的代码:

$('.left .item').draggable({
    revert:true,
    proxy:'clone'
});

 

$('.right td.drop').droppable({
    onDragEnter:function(){
        $(this).addClass('over');
    },
    onDragLeave:function(){
        $(this).removeClass('over');
    },
    onDrop:function(e,source){
        $(this).removeClass('over');
        if ($(source).hasClass('assigned')){
            $(this).append(source);
        } else {
            var c = $(source).clone().addClass('assigned');
            $(this).empty().append(c);
            c.draggable({
                revert:true
            });
        }
    }
});

 

原文及下载地址:http://jquery-easyui.wikidot.com/tutorial:dnd3

 

分享到:
评论
20 楼 kisbo110 2011-03-01  
官网的Demo!
19 楼 cswcfs 2010-06-10  
很好 最近我也在学习jquery
18 楼 joyfun 2010-06-05  
showrock 写道
同志们不要用EASY UI 不开源的东西用了以后出问题只有伤伤伤


到哪里都能见到喷子呀
明明写着GPL3
Code license:
GNU General Public License v3
虽然发布的是压缩的 但是 svn上可以下到未压缩的呀

17 楼 showrock 2010-06-05  
同志们不要用EASY UI 不开源的东西用了以后出问题只有伤伤伤
16 楼 xredman 2010-06-03  
不要打击我,正在学习Ext
15 楼 kisbo110 2010-06-02  
b5158488 写道
ext只是一个即将被淘汰的东西

开玩笑呢吧?EXT被淘汰?
14 楼 highaim 2010-06-02  
听说Jquery EasyUI很强大,早就想学习学习了。
13 楼 cheneyjuu 2010-06-02  
jQuery在用,不过现在正在转向YUI
12 楼 sunwei_1002 2010-05-31  
YUI3很容易实现
11 楼 select*from爱 2010-05-31  
b5158488 写道
ext只是一个即将被淘汰的东西

+1
10 楼 lgstarzkhl 2010-05-31  
果然是不错的效果,学习了,呵呵...
9 楼 FreeWhere 2010-05-31  
我第一次使用jQuery EasyUI是1.03版,那时还非常不完善,组件练Title设置功能没有,自身不带日期选择组件,而且和第三方日期选择组件配合使用也是有问题得。现在1.1出来了,感觉好多了,功能还是比较实用的,但有些兼容性问题还未解决~~
正在再次评估,用来替代公司现在使用的Ext。
8 楼 witcheryne 2010-05-30  
b5158488 写道
ext只是一个即将被淘汰的东西

此话何解????
ExtJS组件很丰富,发展也不错...   
7 楼 cwx714 2010-05-30  
EasyUI在IE6下的问题多了。
6 楼 b5158488 2010-05-30  
ext只是一个即将被淘汰的东西
5 楼 joehe 2010-05-29  
就是太不漂亮了,用ext比你这个效果更好
4 楼 hay 2010-05-29  
IE6情况下产生的一些无语的问题确实让人有点恼。。
3 楼 luorongda 2010-05-29  
code_k 写道
easyui1.1有没有解决在ie6下显示的问题,比如表格的黑边

ie6 还要考虑?
2 楼 code_k 2010-05-29  
easyui1.1有没有解决在ie6下显示的问题,比如表格的黑边
1 楼 cats_tiger 2010-05-29  
EasyUI的作者是楼主?如果是,那太强了!

相关推荐

Global site tag (gtag.js) - Google Analytics