Hi Brian, I don't remember what my initial reasoning was behind that - it was probably one of those coding while watching a movie at the same time moments. I have since changed it to be a local object, with properties attached to that. It seems to work just as well.
Giant Jam Sandwich (to avoid Brian namespace conflicts) On Apr 15, 6:36 pm, "Brian Cherne" <[EMAIL PROTECTED]> wrote: > Hi Brian, > > Is there a technical reason for creating the jQuery.doc object ? Wouldn't > local vars work too? I'm just worried with so common a name as "doc" it > seems like there's a good chance for a naming collision. > > Brian. (I hope people don't think I'm talking to myself...) > > On 4/15/07, Giant Jam Sandwich <[EMAIL PROTECTED]> wrote: > > > > > Hey Roman, > > > Thanks for taking a look in Opera. > > > The plugin actually does support percentages. The pixel widths I > > provided in the demo are just for demonstration purposes. If you do > > use a percentage though, and the user resizes the viewport, it will > > not maintain a perfect center. You would have to fire the > > viewportCenter() method again. I've been toying around with the idea > > of including an optional setting, where if a window resize event is > > fired, the element will re-center. What do you think? Does that sound > > useful? > > > Brian > > > On Apr 14, 1:25 pm, Roman Weich <[EMAIL PROTECTED]> wrote: > > > Giant Jam Sandwich schrieb:> Hey All, > > > > > The viewportCenter() plugin is now in beta, and is available here: > > > > >http://www.reindel.com/blog/src/jquery_viewport_center/ > > > > Hi Brian, > > > > it works nice in FF2 and Opera9.1. > > > > How about an option to use percentage values instead of pixels? That way > > > it would rearrange itself, when the size of the viewport is changed. > > > > This did it for me: (does not support pixel values though) > > > > $.fn.centerElement = function() { > > > return this.each(function() > > > { > > > var el = this; > > > $(el).wrap("<div > > > style='position:absolute;top:50%;left:50%;width:1px;height:1px;'></div>"); > > > $(el).css({position: 'relative', left: el.offsetWidth / > > -2 + "px", > > > top: el.offsetHeight / -2 + "px"}); > > > }); > > > > }; > > > > Cheers, > > > /rw