I need to know how to fade CSS sprite images in the correct effect. I want it like zero opacity to full opacity effect.
There my example:
Click those buttons, then their effects don’t look good. I needed a help…
Thanks!
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
I think that your main problem was that you were only fading to 50% opacity, I have changed this to 0% opacity now.
In addition I have added a couple of other tweeks, the most important being a second queued ‘fadeTo’ effect that fades the sprite back in once the background-position has been changed. This will only be called once the first fade has completed, giving the effect I believe you are looking for.
I have also assigned the $(“#sprite”) selector to a global variable to save the browser performing additional work, making the jQuery more efficient.
It is generally standard practise to name id’s and classes with lowercase letters, it is all too easy not to notice titlecase naming and spend ages figuring out why something isn’t working. Lowercase is safer as a coding standard in this instance.