$$ return an array, then you should use $$()[0] $ return an Element On Tue, Jul 21, 2009 at 1:49 PM, Sebastien BRUNEL <[email protected]>wrote:
> > I've done that, with $$ on page and body, but there is a problem. When > i do an alert on pos.offsetLeft, it return : undefined everytime. > whe, i do an alert on pos, it return divHTMLElement, which s normal. > don't understand hown i can get this offset wth mootools, the code > seems good to me. > > Thanks for your help > > On 21 juil, 14:35, Ryan Florence <[email protected]> wrote: > > $('page') or $$('#page') but not $('#page'). > > > > On Jul 21, 2009, at 3:27 AM, Steve Onnis wrote: > > > > > > > > > You can just use > > > > > var pos = $("#page"); > > > > > And for the css... > > > > > $("body").setStyle("background","#727271 url(squelettes/images/ > > > axome_fond.gif) repeat-x "+pos.offsetLeft+"px 0"); > > > > > ...i think that's right.... > > > > > -----Original Message----- > > > From: Sebastien BRUNEL [mailto:[email protected]] > > > Sent: Tuesday, 21 July 2009 6:37 PM > > > To: MooTools Users > > > Subject: [Moo] Convert Jquery to Mootools > > > > > Hi > > > I have developped this function in jquery for a website, and i have to > > > use it on another site which is using mootools. I've tried to convert > > > it, but no way to make it works. So i ask for your help. > > > The goal of this 2 function is to have a good view of my banner, > > > without the gap of one or two pixel due to the resolution of users. > > > > > Thanks you and sorry for my bad english. > > > > > $(function (){ > > > var pos = $("#page").get(0); > > > $("body").css("background","#727271 url(squelettes/images/ > > > axome_fond.gif) repeat-x "+pos.offsetLeft+"px 0"); > > > > > }); > > > > > $(window).bind('resize', function() { > > > var pos = $("#page").get(0); > > > $("body").css("background","#727271 url(squelettes/images/ > > > axome_fond.gif) repeat-x "+pos.offsetLeft+"px 0"); > -- fax : (+33) 08 26 51 94 51
