aeroswat Posted February 24, 2010 Share Posted February 24, 2010 So I have an update function that does something and then once it's done it should make a div visible then fade out. It does this well. Now I need to know how to set it so this div is always positioned at the top of the page no matter where I am scrolled to. Certain coordinates if you will. Here's the page ____________ | x| | | | | | | | | |___________ | I always want it where that x is Quote Link to comment Share on other sites More sharing options...
developerdave Posted February 24, 2010 Share Posted February 24, 2010 You will want to use CSS and more specifically a fixed position .element { position:fixed; top:0; left:95%;/*change this depending on how wide your element is*/ } That should make it permanently positioned if I'm right Quote Link to comment Share on other sites More sharing options...
aeroswat Posted February 24, 2010 Author Share Posted February 24, 2010 You will want to use CSS and more specifically a fixed position .element { position:fixed; top:0; left:95%;/*change this depending on how wide your element is*/ } That should make it permanently positioned if I'm right oh shit lol. Thanks. Didn't know I could do this with css. Btw since this goes off of the browser window using a % in the left will work right? It doesn't have to be in an outer relative div correct? Quote Link to comment Share on other sites More sharing options...
developerdave Posted February 24, 2010 Share Posted February 24, 2010 I'd just change how far left it needs to be by the %. It can be changed by JavaScript if you have different sized elements. Quote Link to comment Share on other sites More sharing options...
aeroswat Posted February 24, 2010 Author Share Posted February 24, 2010 I'd just change how far left it needs to be by the %. It can be changed by JavaScript if you have different sized elements. I don't think we clicked there lol. I'll try it out though. Thank you. I'll let ya know if anything goes wrong Quote Link to comment Share on other sites More sharing options...
developerdave Posted February 24, 2010 Share Posted February 24, 2010 Lol I wasn't sure what you were asking so I thought I'd just clarify what I meant a bit lol. It doesn't need to be in any extra div or element just apply those 3 lines of CSS and it should be fixed to the top corner. May want to add a z-index to it though if you have loads of elements so it stays on top all the time. Quote Link to comment Share on other sites More sharing options...
aeroswat Posted February 24, 2010 Author Share Posted February 24, 2010 Lol I wasn't sure what you were asking so I thought I'd just clarify what I meant a bit lol. It doesn't need to be in any extra div or element just apply those 3 lines of CSS and it should be fixed to the top corner. May want to add a z-index to it though if you have loads of elements so it stays on top all the time. Ya i usually do a z-index for this of like some crazy number 200 or something just so i'm sure it's on top lol. Btw it works thank you. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.