https://github.com/normanzb/beam
Beam the element up, position element with respect to another element.
https://github.com/normanzb/beam
beam javascript position-elements
Last synced: 3 months ago
JSON representation
Beam the element up, position element with respect to another element.
- Host: GitHub
- URL: https://github.com/normanzb/beam
- Owner: normanzb
- Created: 2014-02-06T10:57:53.000Z (almost 12 years ago)
- Default Branch: master
- Last Pushed: 2018-06-07T16:04:15.000Z (over 7 years ago)
- Last Synced: 2025-10-22T10:43:54.400Z (3 months ago)
- Topics: beam, javascript, position-elements
- Language: JavaScript
- Homepage: http://normanzb.github.io/beam/
- Size: 303 KB
- Stars: 3
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Beam
Position element with respect to another element.
## Usage ##
Move element A to the left side of element B
`$(A).beam().to(B).at("outer left and middle")`
## API Reference ##
### to
`to(el)` Specify the targetting element, source element will be moved to a position with respect to the target element.
### at
`at(location, offset, option, additionalProp`) Specify the location of current element (against targetting element).
* `location` could be: (vertical) middle, (horizontal) center, left, right, top, bottom, outer left, outer right, outer top...
* `offset` Offset { block: 2222, inline: 2222 }, block means vertical offset, inline means horizontal.
* `option` can be the `jQuery Animation Option` or just `true`, if specified, beam will invoke jQuery.fn.animate internally to move target to position with animation.
* set `option.delay = true` will delay current animation and do it all together with the other animations.
* `additionalProp` additional custom animation properties
### end
`end()` stop beaming, return the original jQuery object.
## Known Issue ##
1. Positioning goes wrong when `` or `` has border width, this is due to the differnt returning value of offsetLeft/Top when there are border, even jQuery ignores the width of border in position().