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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T10:54:02+00:00 2026-05-26T10:54:02+00:00

I know this is a weird question in words, so basically I am saying

  • 0

I know this is a weird question in words, so basically I am saying the following. I have this:

$("#dialog-areyousuremodal").dialog({
    resizable: false,
    height: 120,
    modal: true,
    buttons: {
        "Yes": function() {
            $(this).dialog("close");
            // more stuff coming soon
            },
        "No": function() {
            $(this).dialog("close");
        }
    }
}).end().centerFixed();

<div class="hidden" id="dialog-areyousuremodal" title="Delete Confirmation">
    <p>Are you sure you want to delete this row?</p>
</div>

And I have created a custom function that extends jquery like this:

(function($){
    $.fn.extend({
        centerFixed: function () {
            return this.each(function() {
            $(this).end();
            $(this).css({position:"fixed"});
            $(this).css("top", (($(window).height() - $(this).outerHeight()) / 2) + "px");
            $(this).css("left", (($(window).width() - $(this).outerWidth()) / 2) + "px");
            });
        }
    });
})(jQuery);

My goal is to replace .end().centerFixed(); with just .centerFixed();. As you can see I tried putting .end() inside the custom function but that does not work. I’m tried to avoid having to put .end() at the end of the dialog or .centerFixed() on a new line.

Any thoughts on the matter?

  • 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-26T10:54:02+00:00Added an answer on May 26, 2026 at 10:54 am

    You simply can’t I’m afraid, when centerFixed() is called it has no concept of the chain of functions that it has been called at the end of. All it knows about is this, which is whatever object is returned from the function called in the previous chain method.

    Since you’re chaining it at the end of a call to dialog(), inside centerFixed the variable this will be whatever object is the result of that call to dialog() (which I think is the UI dialog object).

    If you want to ensure your code is only run when the dialog is created, the preferred way to do it would be using the plugin’s create event

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

Sidebar

Related Questions

This is a weird requirement I have. I know even my question is quite
I know this is a weird question to ask, but I would like to
I know this one is the weirdest of all weird questions I have asked
I have a weird problem, and I don't know if this is the default
I know this isn't strictly a programming question but y'all must have experienced this.
I don't know if I have all the information needed to phrase this question
I know this is a weird question, but I would like to know if
I was wondering what netstat does? I know this kind of a weird question....
This might be a weird question, but I know what I'm looking for i
I know this question may be weird. But I just want to know whether

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.