Issues with Webkit involving scrolling, a fixed positioned div, and the use of flash content

I am facing an issue with webkit that seems to be caused by a bug in the rendering engine or a feature that I am unable to find a workaround for.

HTML:

<div id="left">
    Content
</div>
<div id="right">
    <div id="scroll">
        <div class="video">
            <!-- Flash -->
        </div>
        Sidebar
    </div>
</div>

CSS:

#left {
    float: left;
    width: 50%;
}

#right {
    float: right;
    position: fixed;
    right: 0;
    width: 50%;
    height: 100%;
}

#scroll {
    overflow-y: auto;
    position: absolute;
    top: 0;
    bottom: 0;
}

JSFiddle: http://jsfiddle.net/andrewryno/pUaM2/1/

The issue arises when there is a flash object inside a scrolling div with a fixed position. When you scroll, everything behaves as expected until you hover over the flash object. At that point, the flash grabs focus and starts scrolling the document instead of the div. This problem appears to occur only in webkit browsers.

The only solution I have discovered so far is wrapping the flash in another div (.video in the provided HTML) and adding:

.video {
    position: relative;
    z-index: -1;
}

However, this fix moves the flash/div behind its parent, making it visible but uninteractive while still allowing scrolling to function properly.

Is there a way to work around this issue? Removing the position: fixed; resolves the problem, indicating that it is related to the fixed position rather than focus stealing.

Update:

I have attempted several JavaScript solutions without success. The z-index "hack" involving changing between -1 and 0 on scroll start/stop did not work because jQuery does not recognize the scroll event when hovering over the flash. Similarly, covering the flash with a div and removing it on click does not work since the first click does not pass through (and JS cannot directly interact with the flash).

Answer №1

Why are you still using the outdated embed code? It's time to switch to iframes, as it's becoming the standard.

Also, there's no need to use fixed positioning. Instead, try using absolute positioning.

#left {
overflow-y: auto;
position: absolute;
left:0;
width: 50%;
height: 100%;
}

#right {
overflow-y: auto;
position: absolute;
right: 0;
width: 50%;
height: 100%;
}

Can you confirm if this setup is functioning as expected?

http://jsfiddle.net/pUaM2/10/

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

Retrieve the element located within a "block" element that is relative to the user's click event, without the

I'm pondering whether it's feasible, but here's my concept: Within my page, there are multiple identical blocks with the same classes, differing only in content. I am unable or unwilling to assign IDs because these blocks are dynamically g ...

Steps for incorporating a scrollbar into the context menu of CKEditor

I am working on adding items to a context menu. However, when too many items are added, they overflow onto the ckeditor area. To solve this issue, I want to implement a scroll bar for the context menu. editor.addMenuItem(suggestionBoxItem, ...

What do you think about removing the Bootstrap styling from the design?

As a newcomer to Bootstrap and currently working on my second project using this framework, I find myself struggling with overriding CSS styles. It can be time-consuming to locate the specific style that needs to be changed rather than starting from scratc ...

Combining two different text alignments within a single paragraph

I need to craft a paragraph with specific alignment requirements: 1st line: align:center 2nd line: align:left 3rd line: align:center 4th line: align:left The alignment should follow this pattern. Is there a CSS method for achieving this? ...

Are CSS animations still triggered even when the element is not visible?

I currently have a loading indicator element that is consistently displayed on my webpage. It can be shown or hidden by adding or removing a specific class that adjusts its opacity and z-index. The element itself contains an image with a CSS animation. My ...

Creating dynamic DIV elements in an AngularJS file using data retrieved from a Sql server

I need to dynamically add elements based on data retrieved from a MSSQL server in the specified area: <div id="ApplicationForm" class="tabcontent" style="display:none;"> <div class="tab_section"> ...

What is the best way to maintain the height of a table row while applying a CSS border to a cell within that row?

I am working on a jQuery script that selects a cell when clicked, and I want the row to maintain its height without changing. Even though I have set the height of the table row using CSS, whenever I change the border of a single cell, the entire row' ...

Is it possible for jQuery UI Tabs to load entire new HTML pages?

In my index.html file, I have set up 3 different tabs. Using the jQuery UI function tabs(), I am attempting to load an HTML page via Ajax. Each HTML page includes the jQuery library and contains the following code: <link type="text/css" href="css/redmo ...

Initializing an HTML5 video player directly from an Array

I am trying to populate a video player on my webpage with an array of videos. Here is the code I have so far: var current = 0; var videos = ["01", "02", "03", "04"]; function shuffle(array) { var currentIndex = array.length, temporaryValue, randomInde ...

Creating a QR code using base64 in PHP and HTML

My PHP code generates QR codes in WordPress, but some tax roles require the code to be in base64. I need help converting my code to work with Hexadecimal Encoding 64 and utf8. Here's a snippet of my current code: <?php $barcodetype = ...

What is the best way to create a layout with two images positioned in the center?

Is it possible to align the two pictures to the center of the page horizontally using only HTML and CSS? I've tried using this code but it doesn't seem to work: #product .container { display: flex; justify-content: space-between; flex-w ...

Are you seeing empty squares in place of Font Awesome icons?

If the Font Awesome icons are displaying as blank squares in all browsers despite correctly linking the stylesheet and attempting to install the package through npm which results in a npm ERR! code E401, it can be frustrating. Even after checking the brows ...

Steps to modify the background color of Bootstrap custom-file-input classes

I am struggling with changing the background color of my input[type="file"]. Despite researching similar issues, none of the solutions I found helped resolve my problem. I am hopeful that someone here can provide some assistance. Below is the snippet from ...

Experiencing trouble with aligning input fields in a Bootstrap layout

When working on a user interface design, I wanted to have different containers with various input type elements. However, I encountered an issue where the datetime picker in one row was not aligning properly with labels above and below it. <div class=" ...

Merging HTML, CSS, and JavaScript in a single file to Generate a Bell Curve with the help of Google Charts API

I'm looking to streamline my code by combining HTML, CSS, and JS into a single HTML script for the existing "Bell Curve Using Google Charts API" project. Check out the project here I've tried putting the CSS in style tags and the JS in script t ...

Positioning a div to the right of another div within a container (box)

I'm currently trying to line up two divs alongside each other within a box. Using angularJS, I am dynamically generating input boxes and looking to include an image for the delete option next to each input box. Despite using "display: inline-block", I ...

Using jQuery to delay hiding for 2 seconds

Hey there! I'm facing an issue with my code. The function is supposed to make #aboutPopOut slide to the left, and then after a 2-second delay, fade out the fadescreen by hiding it. The sliding part works fine, but the waiting and hiding do not seem to ...

Trouble with integrating jQuery Mobile data-role page into a PHP project

Why am I encountering issues when trying to link to the data role page <div data-role="page" id="sessionrecordsuccess"> in the main.php file? Instead of directing me to the specific section, it keeps redirecting to the top of main.php. I have another ...

Having difficulty configuring particlesJS as the background

If you're looking to create a three-page single scrolling webpage with particlesJS as the background, consider using the following resources: particlesJS Website and particlesJS Github Page. An issue arises when trying to set particlesJS as the back ...

What could be causing the image not to load in this code with the img tag?

import React from 'react'; import styled from 'styled-components'; function Navbar() { return ( <Container> <img src='./appleWhite.png' /> </Container> ) } export defau ...