MooPosition position

A function that positions elements in relation to another element, using a simple, user-friendly syntax.



Details

Author
Alan Layt
Current version
position
GitHub
AlanLayt/MooPosition
Downloads
1981
Category
Widgets
Tags
Report
GitHub Issues

Releases


Dependencies

  • _self_/_current_: core 1.3: '*'

How to use

Usage is simple. 'subject' is the element you wish to position 'target' is the element you wish to position 'subject in relation to

subjectPos: y: the vertical reference of the subject (Can be 'top', 'center' or 'bottom') x: the horizontal reference of the subject (Can be 'left', 'center' or 'right)

targetPos: y: the vertical reference of the target (Can be 'top', 'center' or 'bottom') x: the horizontal reference of the target (Can be 'left', 'center' or 'right)

offset is simply the X and Y offset from the position designated above.

$('subject').posRelative({
    subjectPos:{y:'top',x:'right'},
    'target':$('target'),
    targetPos:{y:'top',x:'right'},
    offset:{x:-5,y:+5}
});

The above example would align the top right corner of the subject with the top-right corner of the target. As shown: Screenshot


Discuss

A note on comments here: These comments are moderated. No comments will show up until they are approved. Comments that are not productive (i.e. inflammatory, rude, etc) will not be approved.

Found a bug in this plugin? Please report it this repository's Github Issues.

blog comments powered by Disqus