I have to stick to version 1.2.1 and it does not have the pin/unpin methods. I think I would just look at the code for them from the latest version and build my own methods for this purpose :)
I think this is the right way to go about it. Thanks! Cheers Ankit http://ankitahuja.com On Thu, May 28, 2009 at 8:05 PM, asgaroth.belem <[email protected]>wrote: > > I think you shouldnt be using margin-top & position fixed. > > But instead position:absolute + top:0 > And having javascript relocate the bar upon scroll. but... I better > recomend something premade instead of implementing thsi your self. > > the las version of mootools has a way to do this very simple: > > http://www.docs.mootools.net/docs/more/Element/Element.Pin > > Don need to construct the element via javascript you can just do it in > your normal HTML and set the styles like > > #toggle_bar{ > position:absolute; > top:0; > } > > And then call > > > window.addEvent('domready',function(){ > > $('toggle_bar').pin(); > > }); > > And thats it. > > Plus I think position:fixed does not work on IE6 so you would have to > use javascript to move the div upon sroll anyway. > > On 28 mayo, 06:21, ankit <[email protected]> wrote: > > I want to place a toggle link DIV at the top right hand corner of a > > page. I have to do that for different templates which means that the > > BODY for each template might have different margin & padding > > properties, etc. > > > > Now this works fine for certain templates ( at certain times) while > > for other templates it doesn't work as expected. > > > > How can I make this completely template independent and make sure that > > the div sticks to the top? My guess is properties like 'line-height', > > etc. might be interfering but the position of the div is not > > consistent. > > > > The inconsistency in the position of the div is the problem. > > > > Maybe anyone can suggest a better way of doing this? Or comprehend why > > this is happening? > > > > Here is my code: > > > > http://paste.mootools.net/f45ce680 >
