Giter Club home page Giter Club logo

colresize's Introduction

#动态改变列宽

##功能

  1. 通过拖拽表头,动态的改变列宽。
  2. 双表联动

##如何使用

###引用ColResize.js

<script src="js/ColResize.js"></script>

或者把文件内容复制到自已的库当中,当页面加载完成后,脚本就会为table加载事件。

对无需动态改变列宽的表,只需添加data-col-resize="false" 属性即可:

<table data-col-resize="false">
	

###双表联动 把data-resize-col即可。
例:

<table id="ad" data-resize-col="#table2">	
  • 如果目标表不需单独改变列宽,请在目标表添加data-resize-col="false"
    如:
 <table id="table2" data-resize-col="false">
  • 如果两个表需要相互联动,则只需把data-resize-col,改为对方的id即可。
 <table id="#table2" data-resize-col="ad">

####设置联动关系 在有些框架中,表的代码由后端(.net ,jsp,php)控件生成,不容易加data属性,可通过以下方式设置。

setResizeRelate("div.a>table","div.b>table");

setResizeRelate还有第三个属性,表示是否相互联动,默认为相互联动,若不需,请加fasle;

new ColResize().setResizeRelate("div.a>table","div.b>table");

##兼容性

  • 现代浏览器(Chrome,Oprea,firefox)
  • IE8+

colresize's People

Contributors

etoah avatar

Stargazers

 avatar

Watchers

 avatar  avatar

colresize's Issues

待改进的地方

  • 事件添加,用冒泡替换循环绑定事件
  • 改变事件会频繁的reflow需要改进

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.