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 7588775
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T20:00:23+00:00 2026-05-30T20:00:23+00:00

I have the following code: http://jsfiddle.net/G8Ste/577/ But I would like the effect to go

  • 0

I have the following code:

http://jsfiddle.net/G8Ste/577/

But I would like the effect to go in all directions, instead of just to the right and bottom.

I already tried margin: 0, auto and other css and html styling, to align it to the center, but it doesn’t work.

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-30T20:00:25+00:00Added an answer on May 30, 2026 at 8:00 pm

    The following jsFiddle will center one box inside of another and when being resized it will stayed centered within the parent container. I think this is the effect you are trying to achieve. I am using negative margins to keep the inner box centered. For whatever height/width you are using, just set the margin to half of the width/height.

    http://jsfiddle.net/G8Ste/594/

    EDIT:

    I updated the above jsFiddle to handle relative sizing. There are 2 variables inside the mousedown function that determine the scale of the box. scaleDown is a percentage of the original size you want to scale down to on mouseDown and scale up is a percentage of the original size you want to scale up to on mouseUp. This should work for any sized box since all the values are calculated instead of hard coded.

    http://jsfiddle.net/G8Ste/600/

    EDIT2:

    The code now checks if the box is being animated when clicked multiple times quickly. The code will wait until the previous animation is complete before animating again.

    http://jsfiddle.net/G8Ste/601/

    EDIT3:

    http://jsfiddle.net/G8Ste/613/

    Updated yet again to make it more responsive. I converted the code to a plugin called centeringEffect.

    Usage

    $(‘IMAGES’).centeringEffect();

    Options

    scaleDown: The percentage you want the image to scale down to on mouseDown (Default: .6)
    scaleUp: The percentage you want the image to scale up to on mouseUp (Default: .6)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hey all. I have the following code: http://jsfiddle.net/g7Cgg/ As you can see, there are
I have the following code: http://jsfiddle.net/8fvJN/15/ I am getting a very weird effect when
I have the following code: http://jsfiddle.net/fCWJ5/1/ , and following doubts regarding the viewbox. body{margin:0;}
I have the following code: http://jsfiddle.net/SPWWx/ I'm completely new to javascript, this is my
All of this is code is here: http://jsfiddle.net/yrgK8/ I have a news section which
I have following code (live: http://jsfiddle.net/xyZY8/1/ ): var str = '<div>hello</div><ul><li>Some text...</li>' + '<li>second
let's i have the following code http://jsfiddle.net/QhJWt/ <span contentEditable=true>asdfasdf </span> span { height:20px; width:100px;
I have the following code at http://jsfiddle.net/qPtXL/ As you can see the problem is
I have following code (html,js,jquery) snippet ( http://jsfiddle.net/MUScJ/2/ ): <script type=text/javascript> function someFunc(){ html
I have the following javascript code found also in this fiddle: http://jsfiddle.net/periklis/k4u4c/ <button id

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.