Issue with jQuery UI modal overlay not being able to scroll

I am currently in the process of creating a modal pop-up dialog box. Everything is functioning as expected, but I would like to incorporate scrolling functionality within the dialog box controlled by the main page scrollbar.

At this point, I am unsure whether this issue pertains to jQuery or CSS.

The desired effect can be seen here: (simply click on an image and then scroll using the outer window's scrollbar).

For reference, you can find my code below: https://gist.github.com/sfcarroll/4739040

CSS:

#overlay {
  bottom: 0;
  display: none;
  left: 0;
  margin-right: auto;
  margin-left: auto;
  position: fixed;
  right: 0;
  top: 0;
  width: 100%;
  z-index: 100;
}

#blanket {
  background-color: white;
  bottom: 0;
  display: block;
  opacity: 0.8;
  position: absolute; 
  top: 0;
  width: 100%;
}

.dialog {
  background: white;
  border-radius: 10px;
  display: none;
  margin: 100px auto;
  position: relative;
  width: 700px;
  height: 2000px;
  padding: 40px;
  border: 1px solid #F7F5F5;
  box-shadow: 0 2px 20px rgba(34, 25, 25, 0.5);

}

The example provided utilizes the colorbox plugin, however, I am hopeful that achieving this effect is possible with standard jQuery UI components.

jsfiddle:

http://jsfiddle.net/dEzMp/

Answer №1

Integrate some jQuery snippets:

var dialogPosition = $('dialog').offset().top;

$(window).scroll(function() {
   $('.dialog').css('top', dialogPosition);
});

Update the positioning of your .dialog container:

.dialog {
   position: absolute;
}

Answer №2

I discovered the perfect Twitter Bootstrap extension that meets all my needs.

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

The modal content is not displaying within the dropdown menu

When I call the Bootstrap 5 modal from a dropdown, it only shows a grey background instead of the content. What could I be missing? You can find the code in this JSFiddle link: <div class="container"> <div class="row"> ...

Retrieve every span element within the Hidden field by utilizing JQuery

Recently I started using Jquery and I have a hidden variable that contains all span tags within it. Can anyone guide me on how to access all the span elements inside the hidden field value? For instance, if there are 3 span elements within the hidden fiel ...

Chrome does not support top.frames functionality

I have three HTML pages: main.html, page1.html, and page2.html. I am displaying page1.html and page2.html within main.html using the code below. <!DOCTYPE html> <html> <frameset frameborder="1" rows="50%, *"> <frame name="f ...

The smoothness of jQuery animations is not consistent

I've been working on mastering the art of scheduling animations using JavaScript, in particular with the assistance of jQuery. In an attempt to create a blinking effect for some h1 tags, I noticed that the animation was not running smoothly. It would ...

Ensure that the function .each() waits for the element to be converted to a DataURL

Utilizing html2canvas for the conversion of HTML elements into canvas images, I iterate through the HTML using .each to pass elements to html2canvas. Once an element is converted into a DataURL, it is added to an array called content. $('.itinerary- ...

The next and previous buttons on the JQuery UI datepicker are related to only one ancestor. When using $(e.target).parents(), it will only return a

Unfortunately, my reputation isn't high enough to post my own answer just yet. However, I wanted to share it before wasting more people's time: I finally figured out why I was not getting all the expected ancestors: The JQuery datepicker actuall ...

Implementing a horizontal scrollbar for an AJAX datatable

Is there a way to incorporate a horizontal scrollbar into an Ajax Datatable? I attempted to use "ScrollX" :true, however, this method did not prove successful. $(document).ready(function () { $('#myDataTable1').DataTable({ "aj ...

Style your Checkbox Button with the Checkbox component from Element Plus

Currently, I am utilizing Vue 3 along with the Element Plus library. My goal is to modify the hover, active, and select colors of the Checkbox Button that I have implemented. Unfortunately, my attempts to do so have not been successful. I essentially copie ...

"Implementing a fixed header and footer with a scrolling content area within a parent div that has a fixed position for

I'm seeking assistance with some CSS tasks. Specifically, I need to maintain the same functionality in responsive view when utilizing a fixed position in the parent div (Bootstrap 5 is in use). (the main focus of this project is on fullscreen view of ...

Modify the default border color of the outlined text field

I am seeking to customize the border color of an outlined textfield from gray to a deeper blue shade. <TextField variant={"outlined"} placeholder={t('landing_page.code.placeholder')} onChange= ...

Modify the colors of the chartist fill and stroke using JavaScript

Struggling to dynamically set colors in a chartist graph using JavaScript. How can custom colors be applied through JS? The attempted method below is not successfully changing the color for the showArea in the chartist graph. <!doctype html> <htm ...

Adjusting the spacing between buttons to accommodate the size of the page

Is there a way to dynamically adjust the spacing between 3 buttons based on screen size without changing their original size? I want the buttons to maintain their size while adjusting the space between them. Any ideas are welcome! @import url(https://fo ...

The order of loading ASP.Net MVC jQuery and plugins is incorrect

Looking for help with integrating the TinyMCE HTML editor in ASP.Net MVC? After adding TinyMCE from NuGet, a template (Shared -> EditorTemplates -> tinymce_jquery_full.cshtml) was included. However, this template triggers the JQuery for TinyMCE to r ...

How can I create a custom-sized striped background using CSS?

Looking to replicate the design shown in the image below using only CSS, where a striping pattern extends downwards at an angle from a block of content with a similar color. The challenge is to maintain the base background color outside of this striped are ...

Prevent Bootstrap 4 Select-Picker from automatically opening

I am currently using Bootstrap 4 along with the Bootstrap-select plugin, and I have two buttons set up: <div> <button id="disableButtonId">Disable selectpicker<button/> <button id="enableButtonId">Enable ...

Create a unique inset shadow that surrounds all elements of the content

I'm having trouble figuring out how to create a 4px inset box shadow border that surrounds all of the content. Currently, the box shadow fills the window perfectly (as shown in the fiddle below), but my fixed navigation bar at the top ends up above th ...

What is a better method for aligning an image in the middle of a floated container?

Is there a better way to center an image within a floated div without using an extra p tag? I currently have the image inside a p tag and center the p, but it annoys me having that extra tag. Any suggestions on how to center the image itself? Thanks! Below ...

Is there a Syntax Issue Preventing the Jquery Accordion from Working in IE7?

I have developed a website that utilizes jquery accordion along with some basic functions to control the accordion via external navigation links. While testing it in different browsers, everything seems to be working fine except for IE7. In IE7, the accord ...

What causes an Undefined array key error when using AJAX POST?

I am having trouble passing a text string to a PHP Variable using AJAX. Every time the POST request is sent, I see this error message: Warning: Undefined array key "mydata" Although the alert displays the correct value, the PHP page shows the ...

Is there a way to modify the background color of the altered path in the circular range slider?

Struggling with a function that should change the circle's background color when the slider is dragged to a specific path... $(document).ready(function () { $("#circle").append('<canvas id="slideColorTracker" class="slideColor"></ca ...