"Learn how to set a full-page blur effect and enable a feature where clicking the page automatically scrolls to the

CSS1 worked:

.parentDisable
{    
        z-index:2000;
        width:100%;
        height:100%;
        display:none;
        position:absolute;

        left:0;
        background: url(/images/btrans.png) repeat;
        color: #aaa;
}
#popup
{
    width:300px;
    height:auto;
    position:absolute;
    background-color: whitesmoke;
    color: #6699ff;
    top:40%;
    left: 40%;
}

CSS2 Not working as expected:

    display:none;
    z-index:2000;
    position: absolute;
    width: 100%;
    top: 0;
    left: 0;
    background: #000;
    opacity: 0.5;
    filter: alpha(opacity=50); 

HTML

<div id="pop1" class="parentDisable">
            <center>
                <div id="popup">
                    <div id="loading"> </div>
                    <div id="popupText" align="left"> </div>
                    <a href="#" onClick="return hidePopup_('pop1')" >
                        <img style="position: absolute;top: 0;right: 0" alt="close" src="/images/close.png" width="40px" height="40px"/>
                    </a>
                </div>
            </center>
</div>

Even though CSS1 produced the desired result, the full HEIGHT was not achieved and I need it to be positioned at the current scroll position rather than at the top or bottom. When clicking on a link, the page scrolls up to the top instead of remaining in place. UPDATE1:
To prevent the page from scrolling up when clicking on a link:

Answer №1

Replace position: absolute with position: fixed.

To stop the page from scrolling to the top, make sure to add return false in your javascript function hidePopup_.

The link is trying to go to an anchor #, but since there isn't one, it defaults to the top of the page.

Answer №2

Have you considered applying a position:static to .parentDisable? This adjustment could yield more desirable outcomes aligning with your intentions.

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Learn the process of using calc to rotate images on hover with CSS and Jquery

Is there a way to implement the rotate on hover function for images, similar to what is seen on this website under 'our Latest Publications'? I attempted using calc and skew, however, I was unsuccessful in achieving the desired hovering effect o ...

Is there a way to determine if my great-grandfather has a class attribute that includes a specific word?

Looking for some assistance with my HTML code snippet: <div class='one two three and etc.'> <div> <div> <div class='my_target'> </div> </div> ...

"Applying a class to a div element when it becomes visible within

I am attempting to dynamically add a class to a div element when it comes into view on the webpage. I am utilizing a minified jQuery 1.11.0 script to achieve this functionality. Below is the jQuery code I have implemented: function isScrolledIntoView(ele ...

PHP is having trouble identifying the file extension for file uploads

After sending an array through AJAX and echoing it in PHP, I have the following data: [file] => Array ( [name] => XXXX.jpg [type] => image/jpeg [tmp_name] => D:\xampp\tmp\phpC5F2.tmp [error] => 0 [size] = ...

The getElementById function is unable to locate any matching results

Currently, I am attempting to extract data from an XML file based on the ID of each tag listed within. Below is an example of the XML structure: <?xml version="1.0" encoding="UTF-8"?> <zones> <bedroom id="0"> <fan i ...

steps to repair the toggler button on my website's navigation bar

Currently working on a webpage that requires a double navbar, but encountering issues with the toggler button. It's behaving strangely - not collapsing or showing properly. When clicked, a black box appears around the button and then quickly collapses ...

`Is there a way to retrieve the ID of an element upon clicking on it?`

Can you help me with a JavaScript query? I have two HTML div elements with ids of 'div1' and 'div2'. When I click on any of the divs, I want to display the id of the clicked div. Any thoughts? <div id="div1"></div> <div ...

Any idea why the HTML Select dropdown isn't functioning properly in Angular 2?

I am facing an issue with an Angular 2 Form. I am trying to include an html select but it is not working. I have checked the Angular 2 Documentation and even the live examples provided, like the HERO FORM, are not working. You can view the Hero Form Live E ...

What is the method to capture the change event in a datalist element?

Currently working with a datalist, I am in need of detecting when a user selects an option from the drop-down list. Although a similar question has been brought up, my requirement is for the event to only trigger when the user actually makes a selection fr ...

I am looking to display the precise text from an HTML file while maintaining the original formatting in a Flutter application

When working with Flutter, I am fetching data from an API and need to display its contents. However, some fields include HTML tags. For example, the data I am receiving looks like this - {"id":509,"topic_name":"HTML testing",& ...

Common cross-browser errors to watch for in websites

I've been keeping up with the latest CSS3 elements such as box-shadow and text-shadow: -moz-box-shadow: 10px 10px 5px #888; -webkit-box-shadow: 10px 10px 5px #888; However, in your experience, have you come across any common pitfalls or gotchas (rel ...

Vibrant shades of color overflow the Mui Radio

For my current web project, I am utilizing Mui for styling purposes. I am seeking guidance on how to style a radio button in a way that it appears completely filled with one color when selected. It is important that this styling method is compatible with M ...

What is the method for using jQuery to retrieve hidden fields with the visible attribute set to "false"?

How can I access a control with "visible = false" attribute using jQuery? Some code examples would be appreciated. <tr>   <td class="TDCaption" style="text-align: left">     <asp:Label ID="lblMsg" runat="server" EnableViewState="False" F ...

Tips for posting a data-uri image on Pinterest

I'm attempting to post a data-uri image on Pinterest. Here is the code I am using: <a target="_blank" href="https://www.pinterest.com/pin/create/button/"> <img class="pin-image" src="data:image/png;base64,…"> </a> Following th ...

Ways to retrieve all elements following a chosen element

Is there a way to include the last element too? $('div.current').nextUntil("div:last").css("color", "blue"); <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script> <div>First</div> < ...

Align a component vertically in a FlexBox using Material UI

I have a React app where I created a card with specified min width and height, containing only a header. I want to add flexbox that occupies the entire left space with justify-content="center" and align-items="center". This way, when I insert a circular pr ...

Control other inputs according to the chosen option

Here is the HTML code snippet: <fieldset> <label for="tipoPre">Select prize type:</label> <select id="tipoPre"><option value="Consumer Refund">Consumer Refund</option> <option value="Accumulated Prize Ref ...

Using JQuery to automatically scroll and anchor to the bottom of a dynamically populated div, but only if the user doesn't

I am attempting to achieve the functionality of automatically scrolling to the bottom of a div with the ID #chat-feed. The overflow for this div is set to auto, and I want it to remain at the bottom unless a user manually scrolls up. If they do scroll up, ...

Conceal information within a local HTML document when the browser is not linked to the internet

I am working on an HTML document that currently displays static content. However, I want to integrate multiple YouTube videos using iframes, but only if the browser is connected to the internet. Is there a way to prevent these videos from loading and in ...

In what way does Google Maps display map information at various zoom levels?

I am interested in developing an intricate electronic circuit using HTML. My goal is to display every aspect of the circuit in different levels of zoom, similar to how Google Maps functions. I am curious about the inner workings of Google Maps and how th ...