When I scroll down, the <div> below the <header> disappears, but only the header should be invisible. Can anyone explain why this is happening?

Check out this JsFiddle link for reference.

I have implemented the Material Design Lite framework in my project. In the header section, I want to include a Title row, a row that displays a description (labeled as Story followed by some text), and a row for tabs navigation.

One specific requirement is to achieve the waterfall header effect provided by Material Design Lite, where all header rows except the Title row should disappear when the user scrolls down. However, I need the tab bar to remain visible along with the title row as the user scrolls.

Approach Taken:

Initially, I attempted to move the tabs bar outside the <header> element but style it similarly to appear as part of the header. However, this approach did not trigger the desired waterfall effect on the tabs bar when scrolling.

Interestingly, even when placing the section.tabs-bar outside the <header> element, it still inherited the waterfall effect and disappeared when the user scrolled down.

Hence, the question arises: how can I prevent the section.tabs-bar from disappearing as the user scrolls down?

IMPORTANT NOTE:

Due to the limited display area in JSFiddle's output panel and the responsive nature of Material Design Lite, the header row including the Title and Description might not be visible. Below are screenshots depicting the layout on localhost.

Initial State (User has NOT scrolled):

https://i.sstatic.net/jm9x2.png

Scrolled State (User HAS SCROLLED DOWN):

https://i.sstatic.net/ZnRDD.png

Answer №1

In order to resolve the issue, simply relocate the .task-bar outside of the main section in the JSfiddle example

Additional Information: Include the following CSS:

.mdl-layout__content {
  overflow: hidden;
}

.mdl-tabs.is-upgraded .mdl-tabs__panel {
  overflow-y:scroll;
  height: calc(100vh - 50px);
}

Access the updated JSfiddle here

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

Using PHP to detect changes in input fields upon page load with jQuery

I have a jQuery snippet on my page: $( document ).ready(function() { $("#URL").on("input load", function(e) { console.log(e.type) .... }); }); Further down the page, I also have... <input id="URL" type="text" value="<?=$_GE ...

Centered button text, icon aligned to the right: justify-content

After implementing the HTML code snippet provided in the template, I encountered an issue with the alignment of the icon and text. Currently, they are using justify-content which is not aligning them as intended. <button type="submit" class="btn btn-pr ...

Leveraging the For loop in the MongoDB Aggregation pipeline

Seeking a more efficient way to query data in MongoDB. In my collection, I store hourly information for each user_id. Each document in the collection corresponds to a unique user_id and date combination. However, a user_id can have multiple entries with d ...

What is causing the div to expand even though css max-width is applied?

I am currently facing an issue with the navigation on mobile view while using Bootstrap 4. Specifically, the .nav .dropdown-menu and .text-truncate classes are not displaying ellipsis when the content text length is too long. I have attempted to resolve t ...

What is the most efficient method for choosing a class with jQuery?

I'm dealing with a Bootstrap button: customtags/q_extras.py @register.filter(name='topic_check') def is_topic_followed(value, arg): try: topic = Topic.objects.get(id=int(value)) user = User.objects.get(id=int(arg)) ...

Having Trouble with My PHP Contact Form Online

My website's PHP contact form, based on a bootstrap template, is not functioning properly. I am looking for guidance on how to create or obtain the necessary PHP/AJAX scripts to ensure the form works correctly. Any suggestions or feedback about my con ...

Tips for adjusting image and div sizes dynamically according to the window size

In my quest, the end goal is to craft a simplistic gallery that closely resembles this particular example: EXAMPLE: This sample gallery is created using Flash technology, but I aim to develop mine utilizing HTML, CSS & Javascript to ensure compatibil ...

Design concept - Trigger an action upon clicking a checkbox within a table row

I've been working on implementing a selectable table using material design. I want to trigger an action when a checkbox in a table row is clicked, but my attempts with jQuery have not been successful. Here's the structure of my table: <table ...

Is it impossible to modify an enumerable attribute within a JSON.stringify replacer function?

I'm having some trouble trying to serialize non-enumerable properties within the replacer function. Can someone point out what might be going wrong in this code snippet? Any help would be greatly appreciated. var obj = {x:1,y:2}; Object.definePrope ...

Interactive Notification System with MySQL, AJAX, and PHP

Seeking assistance for code conversion from async ajax to sync ajax. The current code is causing system lag after 20 minutes of inactivity. Likely issue resides within the code snippet provided below. function addmsg20(type, msg, data) { $('# ...

Steps for creating a two-dimensional arc

I want to input some pre-determined acr values from another program and replicate them in three.js Currently, I'm using code I found on this site to draw the arc, although it might not be the most optimal solution. function DRAWarc(){ ...

The discrepancy in percentages by a single pixel within Webkit

I am facing an issue with the positioning of two div elements. The first one has a height of 40% and the second one has a height of 60%. I have set the first element to be positioned at top: 0; and the second one at bottom: 0;. However, in Webkit browsers, ...

Is there a way to update the background image of a div element through a JavaScript file within a react component?

After spending hours on this issue, I am still stuck and have exhausted all my ideas and research. In my project, I have three buttons that are supposed to change the background image of my site. The background image is linked to the default "App" div elem ...

Positional Error Found in Bootstrap Popover Arrow

I'm having an issue with the Bootstrap Popover Tooltip. Can anyone explain why the arrow is not formatting correctly? <div style="display:inline-block;"> <a id="pop" href="#" data-toggle="popover" data-content="<%= user.experience.de ...

Deactivating Bootstrap Modal in Angular

Looking for advice on managing a Bootstrap Modal in Angular 7 I have a Form inside a Bootstrap Modal that I need to reset when the modal is closed (by clicking outside of it). Despite searching on Google, I haven't been able to find a solution. Any ...

Unexpected token { in Fuse-Box when using Typescript

Here's the beginning of my fuse.ts file import { CSSPluginOptions } from 'fuse-box/plugins/stylesheet/CSSplugin'; import { argv } from 'yargs'; import * as path from 'path'; import { CSSPlugin, CSSResourcePlugin, Env ...

Parent function variable cannot be updated within a $.ajax call

I'm facing an issue with pushing a value from inside an ajax call to an array located outside of the call but still within the parent function. It appears that I am unable to access or update any variable from inside the ajax success statement. Any as ...

Storing information in a jQuery basket: tips and tricks

Hello, I am in the process of creating a small webshop. As I add products to my basket, I simply insert a data object into a div like so: $("#ArticlesHolder").data('15', {name:'testname', nr:'4', price:'400', articl ...

Unusual Ajax response detected by JSF ajax listener

Inside one div, there is a form containing two input text fields and a button. Upon clicking the button, the method createProject.register is triggered and the values from the input fields are saved in a database table. <h:outputText id="opt" value="# ...

Adding the "input-invalid" class to the input doesn't take effect until I click outside of the input field

When the zipcode field is updated, an ajax call is made. If there are no zipcodes available, I want to mark it as invalid by adding the "input-invalid" class. However, the red border validation only appears when clicking outside of the input field. Is ther ...