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

  • Home
  • SEARCH
  • 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 6116515
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T15:12:53+00:00 2026-05-23T15:12:53+00:00

I have got a little problem with repositioning a div that should serve as

  • 0

I have got a little problem with repositioning a div that should serve as an infobox.

I am for example executing an AJAX call and on success I get a message from the server. This message is set as the div‘s containing text. As these messages have different lengths I have to reposition the div to have it stay in the center of the parent div.

I am trying to achieve this by using $("#infobox").position({of: $("#parent_field"). The first time it is shown it is in the exact center. But when it is displayed several times in a row it moves further to the bottom right each time.

All this said here is the jsfiddle for my problem. Just click Display Infobox several times to see the problem in action.

  • 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-23T15:12:54+00:00Added an answer on May 23, 2026 at 3:12 pm

    This is, I think, a consequence of hiding the element, as it runs, the offset co-ordinates are added as an inline-style, then the second and subsequent times the function is run it adds together the original offsets required to the ones that are stored inline.

    I don’t know if this is relevant but jQuery UI/API/1.8/Position says:

    Note: jQuery UI does not support positioning hidden elements.

    However:

    adding the following, clearing the style attribute, into the function after the fadeout has completed, resets it and stops the compounding offsets.

    $("#infobox").removeAttr("style");
    

    Forked fiddle example

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

Sidebar

Related Questions

I have a little problem that I don't understand. I have a db that
I've got a little Problem: I want to have Buttons in some of the
I have multithreaded application and I've got a little problem when application ends: I
I've got a little problem on a goDaddy server. I have a php script
I have got a little problem using the CodeIgniter route function. I use the
I'm a starter with mysql and I have a little problem. I've got an
I've got a little problem that's slightly frustrating. Is it possible to set a
I've got a little problem: In my table I have these rows: PersHist :
I've got a little problem in my UITableViewCell. Each Custom Cell have an UISwitch
I have got a little problem. I got a bxslider running on a website

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.