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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T01:09:55+00:00 2026-06-06T01:09:55+00:00

how can i retain focus the popuP window? currently it shows the popup window

  • 0

how can i retain focus the popuP window? currently it shows the popup window but when i click anywhere outside the popup window it closes the window, what i would like to have is to close only when the user click on close button. here is the DEMO

//html:
    <a id='clickShow' class='a'>Click here</a> 
    <div id="popupContact" class='divpopup'>
            <a id="popupContactClose">x</a>
            <h1>Option Image</h1>
            test 123
         </div>
        <div id="backgroundPopup"></div>

//js:

//SETTING UP OUR POPUP
//0 means disabled 1 means enabled
var popupStatus = 0;
function centerPopup(){
    //request data for centering
    var win = {
            height: $(document).height(),
            width: $(document).width()
        },
        pop = {
            height: $("#popupContact").height(),
            width: $("#popupContact").width()
        };
    $("#popupContact").css({
        "position": "fix",
        "top": win.height/2-pop.height/2,
        "left": win.width/2-pop.width/2
    });
    //only need force for IE6    
    $("#backgroundPopup").css({
        "height": win.height
    });   
}
function disablePopup(){
    //disables popup only if it is enabled
    if(popupStatus==1){
        $("#backgroundPopup, #popupContact").fadeOut();
        popupStatus = 0;
    }
}
function loadPopup(id){
    //centering with css
    centerPopup();
    //loads popup only if it is disabled
    if(popupStatus==0){
        $("#backgroundPopup").css("opacity", "0.7").fadeIn();
        $("#popupContact").fadeIn();
        popupStatus = 1;
        getValueOptionImage($(this).attr('id'));
    };
}
function getValueOptionImage(value) {
    $(".option_radio").unbind("change").change(function(e) {
        alert("a ID: " + value + "\nradio Value: " + $(this).val());
    });
}
$(function() {
    $("a").on("click", loadPopup);
    //CLOSING POPUP
    $("#popupContactClose, #backgroundPopup").click(disablePopup);
    //Press Escape event!
    $(document).keypress(function(e){
        if(popupStatus==1 && e.which==27) disablePopup();
    });
});
  • 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-06-06T01:09:56+00:00Added an answer on June 6, 2026 at 1:09 am

    it is due to your event handler being registerd to listen to click on both your close and your background so change

    $("#popupContactClose, #backgroundPopup").click(disablePopup);
    

    to

    $("#popupContactClose").click(disablePopup);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Can't the server just upgrade the temporary credentials to token credentials and retain the
Can I order my users in the database, so I don't have to say
I realize that this would be COMPLETELY bad practice in normal situations, but this
I have developed a simple interactive Flash game, but now it appears that sometimes
I have a databound TextBox in my application like so: (The type of Height
whenever i click on submit button it fires alert(empty username) but goes a head
Can I expect the keys() to remain in the same order? I plan to
Can I get merged cells in some rows while other rows cells remain not
Can anyone let me know how can we change the value of kendo combobox
Can I change the field public virtual ClassOne ClassOne { get; set; } to

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.