Ensure that the modal div has scroll functionality without affecting the background of the page

Website Link:

Instructions: To view the 'Rates' section, simply click on it in the top navigation bar.

When you click on 'Rates', two separate divs will appear on the screen. One div acts as the main background, while the other div contains all the content. Currently, the entire <body> scrolls up and down when you scroll, but what I need is for the <body> to stay locked in place while only the top <div> remains scrollable.

Answer №1

Here are the adjustments to be made:

#modal-div {
    width: 100%;
    margin: 0 auto;
    z-index: 1002;
    display: none;
    padding-top: 100px;
    position: fixed;
    top: 0;
    bottom: 0;
    overflow: auto;
}

Additionally, when the modal is displayed, apply the following CSS rule to the body element:

overflow: hidden;

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

I need help figuring out how to mention an id using a concatenated variable in the jquery appendTo() method

Using jQuery, I am adding HTML code to a div. One part of this code involves referencing a div's ID by concatenating a variable from a loop. $(... + '<div class="recommendations filter" id="recCards-'+ i +'">' + &apo ...

Using PHP's modulus operator, you can dynamically apply CSS classes to a grid of images based on alternating patterns

Exploring the use of modulus to dynamically apply a CSS class to images displayed in a grid under different scenarios: Situation 1 In this situation, the goal is to target and apply a CSS class to middle images marked with *. Since the number of images ...

Do additional MySql tables have an impact on the speed of searches within a MySql database?

I am in the process of considering a database redesign for my classifieds website. Currently, I have 7 different tables in the database, each corresponding to a "MAIN CATEGORY". For instance, there is a "VEHICLES" table that contains information on variou ...

Guide to connecting a different HTML page to a thumbnail image using jQuery

let newColumnBlock = $('<div class="col-md-2">'); let newImagePoster = $('<img>'); let newSelectButton = $('<a href="secondPage.html"><button class="selectButton"></button></a>'); let movie ...

How can I implement a progress bar that mimics an exchange platform behind data-table components? [Using Vue and Vuetify]

I am working on a cryptocurrency exchange book simulator and I am trying to implement a progress bar that will be displayed behind the values in a table. https://i.stack.imgur.com/9gVsY.png This is the template for my data-table: < ...

Is it possible to utilize the Worker class within React Native?

Is it feasible to execute the following code within a react-native environment? let worker = new Worker("./module.js", {type: "module"}); If this does run the module in a background thread, who is managing the thread marshaling process? Given that the Wo ...

Transform the text color of a table generated by a v-for loop

I have a Vue.js setup to exhibit a collection of JSON data which consists mainly of numbers. These numbers are displayed in a table format, with one minor issue - if the number happens to be negative, the text color of its cell needs to be red. <table& ...

Tips for deleting HTML tags from a database

Whenever I add something to my database, it also includes the html tags. Is there a way to prevent this from happening? public function retrieveDataFromDatabase() { $query = "SELECT * FROM gb ORDER BY id DESC LIMIT 0, 4"; //data output if ...

Although sanitize and raw display HTML tags, Slim remains unaffected

I have a dataset with HTML content that I want to display without any tags. Currently, I am working with Ruby on Rails (RoR) and Slim templates. I've experimented with sanitize, raw, and html_safe, but none of them fully removed all the HTML tags. ...

Reorganize divisions using Bootstrap

I am exploring different ways to manage responsiveness through the reordering of divs. While I am aiming for a solution that is highly flexible, any suggestion would be appreciated. Desktop View: https://i.stack.imgur.com/boSOa.png Mobile View: https:// ...

Troubleshooting Gulp Conversion of Bootstrap-Material Scss to CSS: Error Message "Import Not Found"

Upon completing my gulp task styles, I encountered the following error: Error in plugin "sass" Message: static\node_modules\bootstrap-material-design\scss\_variables.scss Error: File to import not found or unreadable: ~bootstrap/sc ...

Display modal after drop-down selection, triggered by API response

Currently, I am working on integrating an API to enable users to make payments through a modal. Users should be able to enter an amount and select a payment frequency. I have successfully extracted various payment frequencies from the API response and pop ...

"Is there a way to adjust the range slider to display currency instead of

I stumbled upon this amazing slider on codepen. Can someone guide me on how to adjust it to display a range from €500 to €6000 while keeping the vibrant red background? I've attempted various solutions like: <input id = "range" type = "range ...

Assistance needed in creating a MVC3 and Razor 2-level horizontal navigation menu

I am attempting to create a 2-level horizontal menu, similar to the one featured on the following site: TV.Com Despite searching on google, I am struggling to put it all together. Below is the sample code I am working with: <div id="divNav"> <u ...

Loop through every attribute using a Jquery iteration process

I am currently immersed in developing a customized jQuery slider. I have a client who needs each slide to change based on the position of the webpage. Essentially, when I'm viewing the first scene and click 'Next', it should display the seco ...

Sticky CSS - A guide to making aside elements fill the entire available height

How can I create a grid layout where the aside is sticky to top: 0 and fills all remaining height (e.g. 100% of height), but when scrolling down, the aside height should be changed to 100% minus the footer's height? Is it possible to achieve this with ...

The multiple-choice selection tool is not displaying any choices

I am having an issue with my ng-repeat code in conjunction with the jquery multiple-select plugin. Despite using this plugin for a multiple select functionality, the options generated by ng-repeat are not visible. Below is the code snippet in question: & ...

Looking to retrieve and display card information within their respective modal using PHP

I am facing an issue with displaying extra data in a modal for my card. I want to access the card ID and its specific data in the modal of the corresponding card. However, when I tried using the same PHP code in the modal, it ended up showing data from eve ...

Should header and footer be incorporated as part of a template design?

Is it considered advisable to include tags such as etc from another page? For example: <?php include_once("header.php")?> Content specific to each individual page <?php include_once("footer.php")?> The header.php file includes: <!DOCTYP ...

Mastering the art of curating the perfect image for your Facebook timeline

Controlling the Like image presented on Facebook timeline can be done using the header element. In my single-page app, I have multiple like buttons, each should be connected to a different image. What is the best way to associate a specific image with e ...