jQuery实现鼠标可拖动调整表格列宽度
一、引入文件:
<scriptsrc="/js/jquery-1.8.0.min.js"type="text/javascript"></script> <scriptsrc="/js/store.js"type="text/javascript"></script> <scriptsrc="/js/jquery.resizableColumns.js"type="text/javascript"></script>
二、TABLE
<tableid="myTable"border="1"> <thead> <tr> <thdata-resizable-column-id="a"><inputtype="checkbox"/></th> <thdata-resizable-column-id="b">栏目类型</th> <thdata-resizable-column-id="c">活动名称</th> <thdata-resizable-column-id="d">状态</th> <thdata-resizable-column-id="e">操作选项</th> </tr> </thead> <tbody> <tr> <td><inputtype="checkbox"/></td> <td>青春日记</td> <td>2014年度青春日记征文</td> <td>提交</td> <td>审核</td> </tr> <tr> <td><inputtype="checkbox"/></td> <td>我和孩子的成长故事</td> <td>成长故事</td> <td>通过</td> <td>审核</td> </tr> </tbody> </table>
以上html只是作为Demo并不是我项目中所实际使用的,并且在测试的时候也未能实现。郁闷...
三、实现表格可拖动
<scripttype="text/javascript">
$(function(){
$("#myTable").resizableColumns({
store:window.store
});
})
</script>
在项目使用过程中发现无需引入store.js<th>也无需data-resizable-column-id属性
并且$("#myTable").resizableColumns();也可实现功能
所需文件下载地址:http://xiazai.jb51.net/201405/yuanma/jquery-resizableColumns.zip
分别解压两个文件
jquery.resizableColumns.js在\jquery-resizable-columns-gh-pages\dist路径下
store.js在store.js-master路径下
热门推荐
1 训练狗狗憋尿
2 狗狗追踪训练
3 狗狗训练要多少钱
5 深圳狗狗训练
6 训练狗狗唤回
7 狗狗叫怎么训练
8 狗狗训练班
10 狗狗社会化训练
11 狗狗叫回训练
12 广州狗狗训练学校
13 狗狗训练躺下
14 狗狗随行训练
15 训练狗狗巡回
16 狗狗要怎么训练
17 狗狗喂食训练
18 训练狗狗躺下