{"name":"dom-align","version":"1.0.2","description":"Align DOM Node Flexibly ","keywords":["dom","align"],"homepage":"http://github.com/yiminghe/dom-align","author":"","repository":{"type":"git","url":"git@github.com:yiminghe/dom-align.git"},"bugs":{"url":"http://github.com/yiminghe/dom-align/issues"},"licenses":"MIT","spm":{},"config":{"port":8000},"scripts":{"less":"rc-tools run less","history":"rc-tools run history","start":"node --harmony node_modules/.bin/rc-server","publish":"rc-tools run tag && spm publish && spm doc publish","lint":"rc-tools run lint","test":"","saucelabs":"rc-tools run saucelabs","browser-test":"rc-tools run browser-test","browser-test-cover":"rc-tools run browser-test-cover"},"devDependencies":{"expect.js":"^0.3.1","jquery":"^1.11.2","modulex":"^1.7.4","precommit-hook":"^1.0.7","rc-server":"^1.5.4","rc-tools":"^1.1.3","react":"~0.12.1"},"precommit":["lint","less"],"gitHead":"0ae6bd0ba291ec66f9b19be5dabfb9b3c8eec466","_id":"dom-align@1.0.2","_shasum":"2059ecc16d8ed6d67669262ac1827f84f66da992","_from":".","_npmVersion":"2.1.18","_nodeVersion":"0.11.14","_npmUser":{"name":"yiminghe","email":"yiminghe@gmail.com"},"maintainers":[{"name":"yiminghe","email":"yiminghe@gmail.com"}],"dist":{"shasum":"2059ecc16d8ed6d67669262ac1827f84f66da992","tarball":"http://registry-npm.ywwl.com/dom-align/download/dom-align-1.0.2.tgz","integrity":"sha512-iflFKTNQbKEXSbGreVeSDPnAgh2QyX6CdMYXNnlRRG+tTExf4i006ECGTvuapMVWDN4G0rDgFRLv8OCfPb+wRg==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDQGIGvT9+Qnm9MW+clDD/gEwWhzweI5j8mF+WbTWUfDAIgXNtMdxcKyH0DuktgKkN0u+bu2zx99vzDdnhU2cCRzi0="}],"size":13339,"noattachment":false,"key":"/dom-align/-/dom-align-1.0.2.tgz"},"directories":{},"readme":"# dom-align\n---\n\nalign source html element with target html element flexibly.\n\n[![NPM version][npm-image]][npm-url]\n[![build status][travis-image]][travis-url]\n[![Test coverage][coveralls-image]][coveralls-url]\n[![gemnasium deps][gemnasium-image]][gemnasium-url]\n[![npm download][download-image]][download-url]\n\n[npm-image]: http://img.shields.io/npm/v/dom-align.svg?style=flat-square\n[npm-url]: http://npmjs.org/package/dom-align\n[travis-image]: https://img.shields.io/travis/yiminghe/dom-align.svg?style=flat-square\n[travis-url]: https://travis-ci.org/yiminghe/dom-align\n[coveralls-image]: https://img.shields.io/coveralls/yiminghe/dom-align.svg?style=flat-square\n[coveralls-url]: https://coveralls.io/r/yiminghe/dom-align?branch=master\n[gemnasium-image]: http://img.shields.io/gemnasium/yiminghe/dom-align.svg?style=flat-square\n[gemnasium-url]: https://gemnasium.com/yiminghe/dom-align\n[node-image]: https://img.shields.io/badge/node.js-%3E=_0.10-green.svg?style=flat-square\n[node-url]: http://nodejs.org/download/\n[download-image]: https://img.shields.io/npm/dm/dom-align.svg?style=flat-square\n[download-url]: https://npmjs.org/package/dom-align\n\n## Screenshot\n\n<img height=444 src=\"http://gtms02.alicdn.com/tps/i2/TB1XIp2HXXXXXajaXXXgJfr8XXX-548-888.png\">\n\n## Install\n\n[![dom-align](https://nodei.co/npm/dom-align.png)](https://npmjs.org/package/dom-align)\n\n## Feature\n\n* support IE9+ chrome firefox\n* support align points and offset\n* support auto adjust according to visible area\n\n## Online Demo\n\n* http://yiminghe.github.io/dom-align/\n\n## Usage\n\n```js\nimport domAlign from 'dom-align';\n\n// use domAlign\n// sourceNode's initial style should be position:absolute;left:-9999px;top:-9999px;\n\nconst alignConfig = {\n  points: ['tl', 'tr'],        // align top left point of sourceNode with top right point of targetNode\n  offset: [10, 20],            // the offset sourceNode by 10px in x and 20px in y,\n  targetOffset: ['30%','40%'], // the offset targetNode by 30% of targetNode width in x and 40% of targetNode height in y,\n  overflow: { adjustX: true, adjustY: true }, // auto adjust position when sourceNode is overflowed\n};\n\ndomAlign(sourceNode, targetNode, alignConfig);\n```\n\n## API\n\n### void domAlign(source: HTMLElement, target: HTMLElement, alignConfig: Object):Function\n\n#### alignConfig object details\n\n<table class=\"table table-bordered table-striped\">\n    <thead>\n    <tr>\n        <th style=\"width: 100px;\">name</th>\n        <th style=\"width: 50px;\">type</th>\n        <th>description</th>\n    </tr>\n    </thead>\n    <tbody>\n      <tr>\n          <td>points</td>\n          <td>String[2]</td>\n          <td>move point of source node to align with point of target node, such as ['tr','cc'],\n          align top right point of source node with center point of target node.\n          point can be 't'(top), 'b'(bottom), 'c'(center), 'l'(left), 'r'(right)\n      </td>\n      </tr>\n      <tr>\n          <td>offset</td>\n          <td>Number[2]</td>\n          <td>offset source node by offset[0] in x and offset[1] in y. \n          If offset contains percentage string value, it is relative to sourceNode region.</td>\n      </tr>\n      <tr>\n          <td>targetOffset</td>\n          <td>Number[2]</td>\n          <td>offset target node by offset[0] in x and offset[1] in y. \n          If targetOffset contains percentage string value, it is relative to targetNode region.</td>\n      </tr>\n      <tr>\n          <td>overflow</td>\n          <td>Object: `{ adjustX: boolean, adjustY: boolean, alwaysByViewport:boolean }`</td>\n          <td>\n          if adjustX field is true, then will adjust source node in x direction if source node is invisible.\n          if adjustY field is true, then will adjust source node in y direction if source node is invisible.\n          if alwaysByViewport is true, the it will adjust if node is not inside viewport\n          </td>\n      </tr>\n      <tr>\n          <td>useCssRight</td>\n          <td>Boolean</td>\n          <td>whether use css right instead of left to position</td>\n      </tr>\n      <tr>\n          <td>useCssBottom</td>\n          <td>Boolean</td>\n          <td>whether use css bottom instead of top to position</td>\n      </tr>\n      <tr>\n          <td>useCssTransform</td>\n          <td>Boolean</td>\n          <td>whether use css transform instead of left/top/right/bottom to position if browser supports.\n          Defaults to false.</td>\n      </tr>\n    </tbody>\n</table>\n\n## Development\n\n```\nnpm install\nnpm start\n```\n\n## Example\n\nhttp://localhost:8020/examples/\n\n## Test Case\n\n```\nnpm test\nnpm run chrome-test\n```\n\n## Coverage\n\n```\nnpm run coverage\n```\n\nopen coverage/ dir\n\n\n## License\n\ndom-align is released under the MIT license.\n","publish_time":1421929120473,"_cnpm_publish_time":1421929120473,"dist-tags":{"latest":"1.12.4"}}