jQuery.offset
jQuery.offset
Is it just me, or would jQuery.offset benefit from accepting parameters as well? Right now code is often the similar to the following
var offset = jQuery(elem).offset();
jQuery(elem).css({
left: (offset.left
+ (whatever)) + 'px',
top: (offset.top +(whatever)) + 'px'
});
whereas we could simply have
jQuery(element).offset(50,50) which would adjust the offset by 50 pixels (positively) in both the x and y directions and we
could have a jQuery(element).moveTo(x,y) which absolutely adjusted the top,left properties to specified values. It would
also be nice to have jQuery(element).moveTo() to accept the return values from offset
// Moves elementA to elementB and then down 10 pixels
jQuery(elementA).moveTo(elementB.offset()).offset(0,10);
Many of us have written functions to do this and I have even my written my own plugin (now owned by another company) to do the same but if we have offset in the core I'd go so far as to argue that these types of simply adjustment methods also be included. I don't think they'd step on the toes of jQuery UI and they would be useful as utility functions if you wanted to use your own UI library (for whatever reason).
Just my two cents,
Gabriel
<br clear="all">
--
Sincerely,
Gabriel Harrison
(if you encounter issues with my gmail account try me at <a href="mailto:nyteschayde@yahoo.com">nyteschayde@yahoo.com</a>
)