Using a subheader in conjunction with a virtual repeater in markdown does not function correctly

Currently, I am utilizing angular 1 along with angular material. I am trying to incorporate md-subheader with multiple md-virtual-repeat-containers within an ng-repeat loop. The source code can be found on this codepen.

The issue I am facing is slightly complex to articulate. To begin with, you need to resize the viewport so that the height is smaller than a full container.

Let's say when I reach the end of one section, a second section should appear and while scrolling, move to the top of the screen and replace the subheader of the first section (demo here). Everything works fine as long as I am scrolling within the first section container. However, once my mouse reaches the second section container, it scrolls within that container and the subheader of the first section still remains at the top of the screen.

You can view a Video demonstration here. Initially, I scroll on the top content, then I scroll on the subheader causing it to move up, finally, when I scroll through the second content, the subheader does not move up as expected (Try scrolling in the second content in the provided angular demo link).

I acknowledge that the codepen shared has another bug present (not occurring in my original sources but randomly appearing in the codepen..), resembling an infinite scroll. You can use the slider on the right to scroll slowly and observe the issue. This particular bug is not the one I am looking to address with this problem.

The HTML structure is fairly simple, acting as a mock pattern to replicate the bug encountered in my application:

<section ng-repeat="title in vm.dataset">
  <md-subheader>{{$index + 1}} Section</md-subheader>
  <md-virtual-repeat-container>
    <p md-virtual-repeat="item in vm.dataset" md-on-demand="{{vm.onDemand}}">{{item.value}}</p>
  </md-virtual-repeat-container>
</section>

I suspect that the issue lies in the necessity to specify a definite height for virtual repeaters containers in order for them to function correctly. This specific setup would function seamlessly with a regular ng-repeat directive.

Answer №1

There is a dynamic CSS feature that adds

transform: translateY(n) !important;

This applies specifically to the element .md-virtual-repeat-offsetter, where the value of n changes based on scrolling.

To remedy this, you can prevent this behavior by including the following code:

.md-virtual-repeat-container .md-vritical-repeat-offsetter {
   -webkit-transform: translateY(0) !important;
   transform: translateY(0) !important;
}

Feel free to check out the updated CodePen link for reference.

I hope this information proves helpful! :)

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

Dynamically insert textboxes into a form by leveraging the power of the Jade template engine

Looking for a solution to a simple requirement that doesn't seem to have a clear answer online. I need a combobox on my jade page that accepts numbers as input. When the user selects a number, I want the page to refresh and display that many textboxes ...

how to combine a string in JavaScript using a prefix and suffix

Anion Gap Body Surface Area (BSA) Creatinine Clearance Stack Overflow i want to add "String" Before Text and "String" after end of text. I have Following expression which runs perfectly in excel:- =CONCATENATE("",B1,"") Output:- <string>Anion Ga ...

Tips for aligning my icon in the middle when I collapse my sidebar

Seeking assistance on centering the hamburger icon on my sidebar. Currently, when I adjust the width of the sidebar, the icon is not centered at all. Does anyone have a solution for achieving this? I attempted using justify-content: center in the main clas ...

Angular directive using ng-if to display image

I have the following code in my showCtrl: $scope.showTeam = function(){ var count = 0; for (var k in subordinates) { if (subordinates.hasOwnProperty(k)) { ++count; } } if(count > 0){ r ...

The straightforward use of XMLHttpRequest to retrieve the response xhttp.responseText is not functioning properly

I am facing an issue where this.responseText is not returning the content of the file. Can someone assist me in solving this problem? Thank you. Console.log also does not return the content of the file. function loadMegaContent() { var xhttp = new XMLHtt ...

Unlinking checkbox click event from row in Angular Material table

I am seeking to remove the ability for row selection in my table rows so that clicking anywhere within the row does not check the checkbox. I want the checkbox to only be checked when the box itself is clicked, allowing me to later add expandable rows when ...

Shopping Directive Coverage Discrepancy

In my application, there is a shop item directive that includes a price attribute. When a user interacts with the directive, the total cost (a variable stored in the main controller) should be updated by the price of the item that was clicked. Unfortunate ...

Upgrading from angular 1.2 to 1.5

After migrating from Angular v1.2.26 to either v1.5.0 or v1.4.8, my application suddenly stopped functioning properly. What specific updates in the code of v1.2.26 should I take note of to ensure that the application runs smoothly again? ...

Dynamic horizontal div elements laid out in a repeating pattern using CSS Grid

I'm fairly new to CSS/Html/JS and I'd like to create a row of Boxes (loaded from a json file) displayed horizontally. Something similar to this: https://i.sstatic.net/ZgxMR.png Here's the code snippet I've been using: <style> ...

Guide for adding a button in HTML table with event creation using ASP.NET and C# language

I am trying to dynamically add a button in each row of an HTML table column using C#. The button is being created for each row, but the click event is not being triggered. Here is the code snippet from the code behind and ASP.NET: public string ge ...

Tips for preventing delays in the digest cycle caused by two-way binding

When does two way data binding get triggered in AngularJS? In my AngularJS application, there is a parent directive and a child directive. Parent Directive: angular .module('myApp') .directive('customForm', function(customService ...

How can I create an asynchronous route in AngularJS?

I implemented route and ngView to display dynamic content, however I received a warning message: The use of Synchronous XMLHttpRequest on the main thread is deprecated due to its negative impact on user experience. For more assistance, please refer to ...

Conflict between multiple jQuery files

Currently, I am in the process of creating a test website for an upcoming project. However, I have encountered some issues with jQuery. This is a static HTML5 website that includes a social widget. The problem arises when I remove a particular jQuery lin ...

The HTML select element fails to drop down over the THREE.js scene

I'm currently working on enhancing the Three.js editor for a project. editor link One of the tasks I'm tackling is adding a select element on top of the viewport in the editor. Unfortunately, the dropdown functionality of the select element isn ...

insert a new DOM element into an array using jQuery

Looking at the code snippet below: a_ajouter = $('.question'); hidden_div.push(a_ajouter); console.log(hidden_div); Upon examining the output in the console, instead of a DOM object being added to the div as intended, it shows &apo ...

Are you able to design a webpage with the following table layout:

Click here to see the design Assign a letter to each table cell and provide all dimensions in pixels. The assigned letters and dimensions should not be visible on the final web page. Make sure the external border of the table is 4 pixels wide, and interna ...

Modify the appearance of the button

Currently, I have a setup where I have three buttons and three panels. When I click on Button 1, Panel 1 loads while Panel 2 and Panel 3 become invisible. Similarly, when I click on Button 2, Panel 2 loads while Panel 1 and Panel 3 are hidden. I would li ...

Guide on inserting a row into a table class without unique values using jQuery

I have gathered information on stackoverflow regarding how to use jQuery to add a row to a table. $('.myTable').find('tbody:last').append('WHATEVER CODE'); Although this method seems to be effective, I have come across the i ...

Guide on inserting a dropdown menu following a specific count of <li> elements using Javascript or Jquery

I am currently working on an HTML project <div class="ktmsg"> <ul> <li class="a1"> <a title="Link Tools" href="#"> … </a> </li> <li class="a2"> <a title="Link Tools" href="#"> ...

The parameters in AngularJS URLs are passed as query parameters

I have configured a $state with the following settings: .state('app.subjects.current', { abstract: true, url: "/:subjectId", template: "<div ui-view />", ncyBreadcrumb: { skip: true } }) .state('app.subject ...