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

The Archive Base Latest Questions

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

I don’t want to have the dialog centered on the screen so I’m setting

  • 0

I don’t want to have the dialog centered on the screen so I’m setting the top and left coordinates of the box. I’m positioning it so that it appears next to a link and won’t initially be open until a click.

$("#error").dialog({
    bgiframe: true,
    autoOpen: false,
    width: 'auto',
    height: 'auto',
    hide: 'slide',
    show: 'clip'
});

and

<div id="error" title="Error">
<div id="errorText">&nbsp;</div>
</div>

From here I want to display an error message on the screen. For instance if I’m at the bottom of the page, I don’t want the user to have to scroll down to see the dialog. Same thing if the error message is all the way on the right, I’d want to display it on the left side of the clicked element. The only problem with this since I have auto width and height it doesn’t seem to know the height/width of the div before I show the dialog; with either $(‘#error’).height() or $(‘#error’).width().

$("#errorText").html(request.responseText + '<p>(Esc or click to close)</p>');
var x = el.position().left + el.outerWidth();
var y = el.position().top - $(document).scrollTop();
var position = el.position();
var bottomOfDialog = position.top + heightOfTheDialog;
if(bottomOfDialog > document.height)
{
     y -= heightOfTheDialog;
}
var rightSideOfDialog = position.left + widthOfTheDialog;
if(rightSideOfDialog > document.width)
{
    x -= (widthOfTheDialog + el.outerWidth());
}               
$("#error").dialog('option', 'position', [x, y]).dialog('open');

How do I get a proper heightOfTheDialog and widthOfTheDialog before the actual dialog is opened? Or should I be using something else?

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

    If your goal is to show the user a message and keep them from having to scroll to discover it – which I believe is the case based on your description – you may want to consider using the jQuery BlockUI Plugin to tell the user the error message. Check out the following demos:

    http://malsup.com/jquery/block/#demos

    I think the growl functionality may be something you could work with.

    The primary benefit here is that the error message would appear in a very consistent place and you would not need to be concerned with the exact location of the “offending” element, but could – at the same time – rest assured that the error message will always be visible to the user.

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

Sidebar

Related Questions

Don't yell at me! i have seen many threads claiming that HTML cannot be
DON'T ASK WHY but... I have a regex that needs to be case insensitive
Don't ask me how but I'm in a situation where I have DCPs published
Don't know if I worded the question right, but basically what I want to
Don't think that I'm mad, I understand how php works! That being said. I
Don't they both have to convert to machine code at some point to execute
Don't overthink this - there's a very commonly used term and I ... have
Don't have much to say, just can get into the event handler. XAML: <Grid>
Don't think my virtualhost is working correctly. This is what I have inside of
Don't ask why but I have the requirement to draw a border around certain

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.