Elemint

  1. /**
  2. * @memberof $
  3. * @method $.offset
  4. *
  5. * @description
  6. * Manage element offsets.
  7. *
  8. * @param {Array|Element} target The target element(s).
  9. * @return {Object} methods An object containing the 'set, get' methods.
  10. *
  11. * @example
  12. * $.offset(target);
  13. * $(target).offset;
  14. */
  15. var offset = function offset(subject) {
  16. var i = subject.length;
  17. (i > 0) || (subject = [subject], i = 1);
  18. return {
  19. get: bind(offsetGet, subject[0]),
  20. set: bind(offsetSet, [subject, i])
  21. };
  22. };