Google Chrome users may experience unexpected position changes in jQueryUI modal dialog when dragging

Chrome version 26.0.1410.64

jQuery version 1.7.1

jQueryUI version latest

The web app is created using asp.net webforms

  • When the page is at the top, the dialog opens normally and functions correctly. However, if the page is scrolled down and the dialog is dragged, the dialog's top css property increases by the vertical scroll amount. This issue only occurs in Google Chrome.

This code segment shows how the modal popup is opened.

    var $dialog = $('<div id="dialogIframe" title="Some title"></div>')
    .html('<iframe id="jqueryIframe" style="border: 0px;" src="' + page + '"
    width="99%" height="99%"></iframe>')
    .dialog({
        autoOpen: false,
        modal: true,
        height: height,
        width: width,
        resizable: false,
        draggable: true,
        buttons: dialog_buttons,
        close: function (event, ui) {
            $('#dialogIframe').remove();
        }
     });

     $dialog.dialog('open');
  • I am troubleshooting someone else's code and unsure of what could be causing this behavior. What could possibly cause this kind of behavior?

EDIT: - The issue is resolved when switching to jQuery version 1.9.1 in Google Chrome, but now the same problem arises in IE9 and the latest version of Firefox (which were working fine with the older jQuery version)

EDIT 2: - I suspect that this problem may be linked to the MaintainScrollPositionOnPostback page property in webforms, which I am struggling to disable or set to false through various methods: on the aspx page, in the code-behind, on the master page, or in the web.config file. It's quite challenging.

Answer №1

Encountered a similar issue in Chrome, but managed to resolve it by:

open:function(){
    $('body').addClass('stop-scrolling')
},

beforeClose: function( event, ui ) {
    $('body').removeClass('stop-scrolling')
},

This solution worked for me as my dialog was small. However, if your dialogue contains more content than can fit on the screen, you may run into trouble.

The CSS class used is:

.stop-scrolling {
height: 100%;
overflow: hidden;
}

This class effectively prevents the body from scrolling.

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

Utilize jQuery to automatically assign numbers to <h1-h6> headings

Looking to develop a JavaScript function that can automatically number headings (h1- h6) for multiple projects without relying on CSS. Currently achieving this with CSS: body { counter-reset: h1; } h1 { counter-reset: h2; } h2 { counter-reset: h3; } ... T ...

Struggling to click on a link while viewing the site on your mobile device?

Recently dove into the world of implementing mobile responsive design for a website I've been working on. While conducting some testing, I observed that the main tabs which direct users to different sections of the site, normally easy to click on desk ...

Wordpress Sub-Menu Being Eclipsed by Banner

After upgrading my Wordpress to version 3.5.1, I noticed a problem on my site where the Submenus are loading but quickly getting hidden behind the Banner. Despite trying various modifications in the CSS file, the issue remains unresolved (and might have wo ...

The fuse-sidebar elements are not being properly highlighted by Introjs

I have recently developed an angular project that utilizes the fuse-sidebar component. Additionally, I am incorporating introjs into the project. While introjs is functioning properly, it does not highlight elements contained within the fuse-sidebar. The ...

Assign a class to the "li" element containing an "a" tag with the specified href attribute

Is it possible to transform the "href" attribute of an element into a class or id like "li" for better css handling? <ul> <li><a href="#section3"><span class="fp-sr-only">due</span><span></span></a><d ...

Instead of modifying the selected class, jQuery generates inline styles

Utilizing the following code to dynamically create a class: $("head").append('<style type="text/css"></style>'); var newStyleElement = $("head").children(':last'); newStyleElement.html('.move{transform: translateX(1 ...

Angular ensures that the fixed display element matches the size of its neighboring sibling

I have a unique challenge where I want to fix a div to the bottom of the screen, but its width should always match the content it scrolls past. Visualize the scenario in this image: The issue arises when setting the div's width as a percentage of the ...

"Eliminating the visual feedback frame from your Samsung Galaxy browser: A step-by-step

After clicking a link, a dark orange frame is displayed around it. This frame can sometimes persist until the next scroll or screen touch. Similarly, when other elements are clicked, an orange frame may appear, adjusting in size to reflect the element cli ...

What is causing my 100% height to be excessively large?

I'm facing an issue with my background containers, "background-overlay" and "background-gradient", as they are extending the height of the document beyond the actual content displayed. I am unsure of what could be causing this problem. It might be som ...

Break down the organization of CSS

While exploring a website, I came across this CSS code that sets the font family to "Open Sans," Helvetica, Arial, and sans-serif. However, I am having trouble understanding this structure. Any assistance would be greatly appreciated. Thank you in advanc ...

How can I create a component that dynamically adjusts to different screen sizes

I have developed three child components for the main content area (excluding the header) However, one of the components is not responsive. Below is the code snippet: <div className="row" style={{marginTop:'30px',}}> <div class ...

Creating a ToggleButton in C#Is a Togglebutton the

I am trying to create a togglebutton for a website with Microsoft Visual Studio and am not sure if this would be the correct code to apply. I am working in C#, so the button is going to be generated in C# (and a bit of jquery) code and eventually styled in ...

Error: The selector "button" cannot be used in its current form as it is not pure. Pure selectors must include at least one local class or ID

<button onClick={() => resetBoard()}> Reset Board </button> While trying to import an external CSS file as a module, I encountered a problem. The CSS file looks like this... button { background-color: ...

How can I make a DIV grow taller without impacting neighboring DIVs?

I am working on expanding a specific DIV within a series of DIVs for an image gallery. However, I am facing an issue where when I expand the particular DIV, it affects all the following ones and causes them to shift positions, leaving a large blank space t ...

Chat lines in Chrome displaying double entries - troubleshooting needed

I developed a chat plugin for my website with a simple HTML structure: <div id="div_chat"> <ul id="ul_chat"> </ul> </div> <div id="div_inputchatline"> <input type="text" id="input_chatline" name="input_chatline" val ...

Guide to positioning a top navigation menu with dropdown items in the center using CSS: absolute positioning

I have implemented a pure CSS menu from this source on my website. It functions properly in the 'hamburger menu' mode, but I am encountering difficulties when attempting to center or right-align the menu in other modes. Despite trying various so ...

The structure of the figure tag for HTML5 validation

Could you please confirm if the Figure tag is correctly used in the html structure? Regarding html5 validation, can I use this structure? <a href="#"> <figure> <img src="" class="img-responsive" alt=""> <figcaption> ...

Most Effective Method for Switching CSS Style Height from "0" to "auto"

After coming across a question with no answer that suited my needs, I decided to share the solution I created. In my case, I had a hidden generated list on a page which was initially set with a CSS height of "0" and then expanded upon clicking by transit ...

What is the best way to position an image in the center for mobile screens?

Struggling to center an image for mobile devices, I have successfully done so for tablets and regular desktop devices. However, I am facing challenges in editing the code to ensure full responsiveness for mobile devices. Additionally, there is excess white ...

Add flair to the ButtonBase element within a Tab component

I'm currently exploring how to override Material UI styles with a nested component. For instance, what if I want to increase the bottom border height on an active Tab, which is applied by the underlying ButtonBase. Below is the style definition: con ...