Conceal the scrollable content beneath a stationary transparent header, allowing the background to

Imagine having a background image, fixed header with transparent areas, a content div with semi-transparent background, and dynamic height in a traditional header/content/footer layout.

The desired effect is to have the background and content scroll under the fixed header, where the content remains hidden and the background visible.

While browsing through various resources like the discussion on Hiding Scrolling Content Under Transparent Header, I found solutions that catered to fixed backgrounds. However, my design requires a scrollable background.

I was able to achieve this by incorporating the same background image into a wrapper div for the header image and using jQuery's .scrollTop() to control the scrolling on window scroll events.

View the examples here: jsbin Example
Reference: jsFiddle Example

A major issue with this method is sync problems (lag, tearing) across all browsers except Firefox.

To clarify: The content height will vary dynamically, as shown by the 10000px example chosen. There are cases where it may exceed this length due to AJAX feeds, while other pages could have minimal content nearing 0. It’s important to note that the footer div appears beneath the content div.

I believe there must be a more efficient approach. Any suggestions?

Answer №1

Have you considered utilizing a positioned scroll pane or scroll area to enable scrolling of your dynamic content, positioning it directly beneath your fixed header?

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

adjust the fixed div's width to match the percentage-defined width of its parent element

My goal is to make a div with the position: fixed property have the same width as its parent element, which is a td. However, I am having trouble achieving this. Here is my current code: HTML: <table style="width: 90%; border: 1px solid black;"> & ...

Bug with the animation of height in Jquery

Unfortunately, I can't share my entire source code here because it's quite lengthy. However, maybe someone can provide some insight into a common issue that may be happening elsewhere. The problem I'm facing is with a DIV element that has r ...

Zoom out the slider when scrolling

Take a look at this link and as you scroll down the page, notice how the image transitions to iPhone. Can anyone provide insight on how this effect is achieved? ...

Border concealed by Bootstrap Glyphicons

Is there a reason why glyphicons hide a border of a floated container? Can anyone shed light on this issue and suggest a workaround? Check out this link for more information. https://i.sstatic.net/CXZSd.jpg My setup: OS X 10.11.1, Chrome 47.0.2526.73 (6 ...

What is the best way to showcase information from multiple JSON files simultaneously?

Creating dynamic JSON URLs based on browser cookie data. var cookie = $.cookie('faved_posts'); The cookie contains IDs like 123456, 111111, 000001, etc. Now we need to request the JSON file for each ID in the cookie. We have: $.each(cookie, ...

Page resizing is disabled in Chrome after an Ajax load

I've been tirelessly working on the CSS for a website I'm building, and I've encountered a strange issue that only seems to affect Chrome. Firefox and Internet Explorer work perfectly fine. I am using jQuery to load HTML stubs and a signifi ...

Is there a specific measurement or scale for the dragging feature in jQuery UI draggables?

I'm interested in adjusting the position of my draggable element based on the distance moved by the mouse. For instance, if the scale is 1:2 and the cursor is moved 10px to the right, then the draggable should move 20px. I already have my draggable ...

CSS/HTML: Resolving Internet Explorer's Div Positioning Challenges

I've been struggling to find a resolution for this issue but I haven't been able to come up with anything effective. Here's the basic concept of what I'm trying to achieve. My goal is to have my layout divided into 3 divs. The first se ...

Can a form be designed to submit a list separated by commas through a GET request?

Imagine having a form that includes multiple checkboxes under the same name, c. Each checkbox is assigned an integer value. Upon submitting the form using GET method, the desired URL format is www.url.com/?c=1,2,3,4,5 rather than www.url.com/?c=1&c= ...

personalizing jquery templates

Currently, I am utilizing a jQuery template to showcase specific values. Within this template, I have included an if statement to determine if the age is considered old or not, with the result altering the background color accordingly. Previously, the co ...

What is the best way to determine if a jQuery AJAX response contains HTML elements?

On my webpage, I have a single form that triggers an AJAX call which can result in two different responses. One of the responses only includes a status code. In order to display any HTML contents returned by the response object on my page, I need to exami ...

Adjust the product percentage discount color in WooCommerce

I am struggling to switch the box color of the percentage discount for each product from green to red. I tried modifying the function I found on Reddit, but I couldn't get it right and it caused a fatal error, crashing the entire website. Here is the ...

Using loops in Sass mixins causes errors

I have been developing a SASS code to generate CSS output that has the following format. background: -webkit-linear-gradient(top, 50%); background: -moz-linear-gradient(top, 50%); background: linear-gradient(top, 50%); This is the SASS mixin code I cr ...

Uncertainty arises from the information transmitted from the controller to the Ajax function

In one of my coffee scripts, I have an AJAX call that calls a method in a controller. The AJAX call is structured like this: auto = -> $.ajax url : '<method_name>' type : 'POST' data : <variable_name> ...

Position navbar contents at the top of the screen

As I delve into learning Bootstrap4, I have come across the following snippet of HTML code: <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> ...

Include a carrot icon on a navigation element that is currently active, ensuring it does not disrupt the position of the navigation icon within the container

I am working on a react navigation bar where I want to emphasize each navigation item with a carat when the user is on a specific URL or route. I have been trying to use the :after pseudo-class in Sass to add the carat, but it's not working as expecte ...

The art of positioning images and creatively cropping

Seeking advice on allowing users to dynamically position and clip an image on a webpage. I've tried using CSS and JavaScript for clipping and resizing, but it's not working as expected. If PHP could provide a solution, that would be ideal for my ...

Generating JSON Data with the Power of JavaScript and JQuery

Looking to dynamically generate a JSON Object with the specified structure: { "deleteId":[1,2,3], "pointId":[1,2,3], "update":[ { "what":"mission", "id":1, "value":"adsda" }, { ...

I need help with creating an AJAX JSON call using Angular. Let me share the JavaScript function that I currently have

When a button is clicked, the function below is called. It retrieves data from a JSON file and stores it if a success message is received. Here is a screenshot of the returned data. My JavaScript function is working correctly, but I am new to Angular and l ...

Place background image in the center with a background color overlay

After browsing through this post on Stack Overflow, I managed to stretch my background image using CSS with the background-size: cover; property. However, I realized that this solution doesn't completely meet my needs. I'm dealing with an image ...