Is it possible to have a picture animate from the center outwards rather than from left to right (and top to bottom)? The effect I’m trying to achieve is similar to lightbox, when you click on an image and it expands outwards.
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.
@Aron’s solution is ok, but it comes with certain limitations: you can’t have an image within the document flow.
My solution actually creates an absolutely positioned clone of the image and shows it on top of the original image. It calculates the original image’s absolute position using
.offset().The disadvantage of this method is that if the document flow changes (such as when resizing the client window), the absolutely positioned element stays at the old position. It depends on the layout of your page if you can use this method or not.
Click on the image in my demo to toggle the effect. http://jsfiddle.net/Xhchp/3/
HTML:
CSS:
javascript: