What causes overflow-x scroll to prevent scrolling to the left unless the initial scroll is to the left?


 <div class="row justify-content-center  mob-view" >

        <div class="col-lg-3 col-md-4" *ngFor="let slide of specialization">
          <div class="brower-box">
              
                <div class="brower-image"> </div>
             
          </div>
        </div>
</div>


    @media(max-width :768px){
         .mob-view{

                  min-width: 100%;
                  display: flex ;
                  flex-direction: row;
                  overflow-x: auto;
                  flex-wrap: nowrap ;   } }
      

When looking at the provided HTML code, there is a loop created by ngFor that populates the div with the class "brower-box" with about 31 elements. These elements load correctly on various devices and viewports. However, the goal is to have these elements scroll horizontally within a mobile view. CSS properties like flex and overflow were applied to achieve this.

ISSUE

While applying flex and overflow achieved the desired horizontal scrolling effect, only the elements starting from the 16th position were accessible for scrolling. Initially, scrolling left was not possible as it started directly from the 16th element towards the right. Scrolling back from the 31st to the 16th element worked, but going further left to access elements 1-15 was not allowed. Despite all 31 elements being loaded inspecting through Chrome DevTools, accessing them via scrolling was restricted. Any insights on what might be causing this limitation would be greatly appreciated.

Answer №1

After spending nearly a full day troubleshooting, I was able to identify and solve the issue myself. While it may seem like a small problem, it can be quite frustrating to deal with. I wanted to share my solution in case anyone else encounters the same issue.

The key to resolving the issue was making some changes to the CSS code. By adjusting the styles for smaller screen sizes, I was able to fix the layout problem.

css

       @media(max-width :768px){
         .mob-view{

                  min-width: 100%;
                  display: flex ;
                  flex-direction: row;
                  overflow-x: auto;
                  flex-wrap: nowrap ;
                  justify-content: unset !important;   } }

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

Having trouble understanding the purpose of an if statement?

One specific piece of information eludes me - what is the purpose of if(""!="")? Take a look at this example illustrating its use: if(""!=""){document.write('<iframe src="'+''+'" border="0" alt="" style="display:none"/>&apo ...

The technique for ensuring that all subscriptions are completed within a for loop before moving forward

In my app, I have a scenario where I need to fetch JSON data in a series of "category data" subscriptions inside a for loop. This data is then filtered based on the user's current location. The issue I'm facing is that my app doesn't wait fo ...

Learn how to activate a JS native event listener using jQuery for the 'change' event

This question is unique from the one found at How to trigger jQuery change event in code. The focus here is on the interaction of jQuery with native event listeners, rather than jQuery event listeners. I am using addEventListener to bind a change event fo ...

"Using PHP to generate HTML code for creating a hyperlink with

I am looking to pass ID values using GET to another website. These IDs are retrieved from a database and stored in the $row variable. <table> <?php foreach ($pdo->query($sql) as $row) { ?> <tr> <td><?php echo $row[ ...

Eliminate resistance on HTML components

Have you ever noticed that when you click on an HTML element, such as images, you can drag a "shadow version" of them around on the screen? For example, take the Stack Overflow logo. If you click and drag it, you'll see a dark version of the logo mov ...

What is the best way to enlarge icons and space them out evenly along a single line?

Would anyone be able to assist me in increasing the size of and separating these three icons that are close to each other using CSS3 in a single line? I am utilizing Bootstrap5 and Google Icons. <link href="https://fonts.googleapis.com/icon?family= ...

Internet Explorer not recognizing attribute selector in jQuery

My JavaScript code utilizes the css selector [style="display:none"], and it functions correctly in Chrome, Firefox, Opera, and Safari on Windows. However, in Internet Explorer 11, it behaves unexpectedly. To test this issue, simply click on the buttons (e ...

It is not possible for jQuery to modify the style of ul and li elements

$(document).ready(function(){ $(".menu").on('click', 'li', function () { $(this).css('background-color', '#000000'); }); }); </script> <ul class="menu"> <li onclick="window.location.href=&apos ...

What is the best way to display just four boxes on a screen that has a scrolling element?

I have a container element with a specific width (while the height can vary) and a scrollbar. Inside this container, there are boxes. Each box has dimensions equal to half of the width/height of the container with the scrollbar. My goal is to display only ...

Attempting to extract data from a text input field using AJAX and then transferring it to a different webpage

Having trouble getting the values entered in a textbox using ajax and sending them to another .php file. I was successful with a checkbox before, but unable to replicate it this time. Below is the code for the text boxes: <div align = "right"> & ...

"Trouble in managing heading tag within column due to overflowing instead of adjusting

I have been working on designing a simplistic calendar that displays two weeks with time blocks. While I have created a template for it, I am encountering an issue where the text in the time blocks is overflowing outside their container. https://i.sstatic ...

display a div beside the anchor element using jQuery

I could really use some assistance. I'm fairly new to jquery and I'm encountering an issue that appears to be quite simple. I apologize if this has been asked before, but I couldn't find the solution I needed. My problem involves having 2 l ...

Strategies for Text and Content Alignment in Angular Using CSS

Trying to format the text in my expand/collapse question bar using angular. Below is a snippet of HTML/Angular code amongst many others. <mat-expansion-panel hideToggle> <mat-expansion-panel-header> <mat-panel-title> User Data ...

How can I implement a master-detail view in Angular 2?

Update: I finally figured it out. After moving all the html from index.html to app.component.ts, everything started working perfectly. The method described below is the correct one. I've been facing an issue where I have a ParentComponent that retrie ...

What steps can I take to ensure that the v-main element occupies at least 70% of the viewport height in Vuetify?

As a newcomer to Vuetify, I am still learning the ropes. One thing I've noticed is that <v-main> automatically expands to fill the space between <v-app-bar> and <v-footer>, taking up the entire viewport height. My concern arises wh ...

Navigate to the bottom of the screen following the addition of a new element to the DOM in Angular 6

Within my form, I am continuously adding objects to an array and then displaying a preview for the user. Using a *ngFor loop, I am able to iterate through the array and display each element on the screen. To enhance user experience, I want the page to aut ...

Enhance the appearance of the CKEditor by applying CSS styling to both the Preview

Can I apply CSS to customize the appearance of both the Editor text and the Preview? The CMS uses separate CSS files for the backend compared to the frontend of the website, and I would like the editor to mimic how the content will appear on the site. Fo ...

Access various data from the local storage and display them inside a div container

I am trying to display the keys and their values for all the data stored in the local storage. Here is the HTML and JavaScript code I have written: // Setting some values in the local storage localStorage.setItem("lastname", "Smith"); localStorage. ...

The div is struggling to contain the image, can anyone assist with this issue?

Greetings all! I am a beginner with CSS and currently working on my website. You can check it out at this link. I am facing an issue where the image on my site is not fitting properly and it keeps repeating. Can anyone guide me on how to fix this using CS ...

ng-class not functioning properly when invoked

In my controller, I have the following function: $scope.menus = {}; $http.get('web/core/components/home/nav.json').success(function (data) { $scope.menus = data; $scope.validaMenu(); }).error(function () { console.log('ERRO') }); ...