Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

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.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4586362
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T21:37:42+00:00 2026-05-21T21:37:42+00:00

Is it possible to have a picture animate from the center outwards rather than

  • 0

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!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-21T21:37:43+00:00Added an answer on May 21, 2026 at 9:37 pm

    @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:

    <p>Some random text.</p>
    <p>More blah. <img id="someImage" src="http://upload.wikimedia.org/wikipedia/commons/thumb/1/16/Deletion_icon.svg/600px-Deletion_icon.svg.png"/> More blah.</p>
    <p>Some random text.</p>
    

    CSS:

    #someImage { width:32px; height:32px; }
    

    javascript:

    function ZoomIn(){
        var p = $(this).offset();
        var w = $(this).width();
        var h = $(this).height();
        var $clone = $(this).clone();
        $clone.css({
            position: "absolute",
            left: p.left + "px",
            top: p.top + "px",
            "z-index": 2
        }).appendTo('body');
        $clone.data("origWidth",w);
        $clone.data("origHeight",h);
        $clone.data("origTop",p.top);
        $clone.data("origLeft",p.left);
        $clone.animate({
            top: "-=" + Math.floor(h * 0.5),
            left: "-=" + Math.floor(w * 0.5),
            width: Math.floor(w * 2),
            height: Math.floor(h * 2)
        },function(){
        });
        $clone.click(ZoomOut);
    }
    
    function ZoomOut(){
        var w = $(this).data("origWidth");
        var h = $(this).data("origHeight");
        var t = $(this).data("origTop");
        var l = $(this).data("origLeft");
        $(this).animate({
            top: t,
            left: l,
            width: w,
            height: h
        },function(){
            $(this).remove();
        });
    }
    
    $(function(){
        $('img').click(ZoomIn);
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

is it possible to have a specific element on top of the list? backgoround:
I'm trying to implement a way to animate (translate, fade) controls around (more than
Possible Duplicate: Image Button in BlackBerry Is there a way to have a picture
Is it possible to achieve something like this: I have one picture to set
I am trying to have a picture to load onclick into an alert box
I have a JavaScript Picture gallery. The arrows under the gallery make possible to
I have an Android application where I'm trying to send a picture to a
I'm trying to work out whether it's possible to have the partially checked checkbox
i have 3 tables. Employees Contractors Jobs The picture below illustrates two possible scenarios
I have a picture in shades of gray. Is it possible to recolor the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.