Salut, Sebastian. See if this works. It's an accurate replication of your code in MooTools-speak. Personally, I'd attempt a pure CSS solution for your problem, but of course I don't know all the details on what you want to achieve and in which context.
As I can't really test the code, it is provided 'as is'. ;) Remaining bugs should be minor, though. Traditionally, the .getPosition()-method might deliver slightly different results compared to the jQuery- equivalent. I wasn't sure if offsetLeft was a native JS-property on an element. If it is, you can replace the method call with the previous access to offsetLeft. MooTools code (should work with v1.2): $(function (){ var pos = $("page").getFirst(); $$("body").setStyle("background","#727271 url(squelettes/images/ axome_fond.gif) repeat-x "+pos.getPosition().x+"px 0"); }); window.addEvent('resize', function() { var pos = $("page").getFirst(); $$("body").setStyle("background","#727271 url(squelettes/images/ axome_fond.gif) repeat-x "+pos.getPosition().x+"px 0"); }); On Jul 20, 9:56 am, Sebastien BRUNEL <srbru...@gmail.com> wrote: > 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"); > > });