terryds Posted February 16, 2013 Share Posted February 16, 2013 Hello all...Could you tell me the code to make the screen fading in when the page loads?It's like in santa-mars.blogspot.comThe screen fades in when the browser loads it.. For example, could you give me a code that the screen and a rectangle fades in when the browser loads the page ? Link to comment Share on other sites More sharing options...
justsomeguy Posted February 18, 2013 Share Posted February 18, 2013 One way to do that would be to start the content off where it's invisible using CSS opacity, and then use setTimeout or setInterval in Javascript to increase the opacity over time until it gets to 1. All animation in Javascript is done using either setTimeout or setInterval, if you're not familiar with those then do some research to see how they work. Those functions are how you make things happen over time in Javascript, like a fade effect. Link to comment Share on other sites More sharing options...
callumacrae Posted February 19, 2013 Share Posted February 19, 2013 Please don't do that, that is disgusting. Link to comment Share on other sites More sharing options...
dsonesuk Posted February 19, 2013 Share Posted February 19, 2013 The problem is, with setting content as invisible using css opacity, and if the user has JS disabled in his/her browser, the content will remain invisible. Link to comment Share on other sites More sharing options...
callumacrae Posted February 19, 2013 Share Posted February 19, 2013 The problem is, with setting content as invisible using css opacity, and if the user has JS disabled in his/her browser, the content will remain invisible.If you hide it using JS in the first place (there are ways to do it that will hide it before it appears to the user), that won't be a problem. Link to comment Share on other sites More sharing options...
dsonesuk Posted February 19, 2013 Share Posted February 19, 2013 Well Gosh! i never would have thought of that. so glad you here to state the obvious. Link to comment Share on other sites More sharing options...
justsomeguy Posted February 19, 2013 Share Posted February 19, 2013 Please don't do that, that is disgusting.I hope you can understand why posts like that are not helpful and do not contribute anything to the discussion. Your opinions are fine, but they're just that - opinions. If someone wants to have a fade in effect, who are you to tell them they shouldn't do that? Why does your opinion matter so much that people should ignore what they want to achieve just because you tell them not to do it? You don't even bother to justify your opinion, ask why they want to do it, suggest alternatives, etc. If you want to contribute here that's great, but you need to offer more substance than your opinions on telling people what they should or should not do. If you have an opinion then back it up with reasoning, don't just go around telling people they shouldn't do this or that. Tell them why, offer alternatives, etc. Saying "that is disgusting" is not helpful in any sense to someone trying to learn. That's what we're here to do, we're here to help people learn. If your infinite wisdom and experience has given you insight that no one else has, then please share it. Make a positive contribution to the discussion, we don't need a contributor here who just goes around telling people not to do things. 2 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now