Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
269 views
in Technique[技术] by (71.8m points)

html - Strange scrolling issue in Chrome (Can't scroll with mousewheel)

I've done something (I obviously can't work out what) that has messed up scrolling on Google Chrome desktop browser on a single page on my site. I am using html templates (Django), but the issue still occurs when I construct a complete webpage, as below. Also worth noting is that I'm using tailwindcss, but again this doesn't seem to be directly connected to the problem.

The weird thing is that the mouse wheel scroll works in Firefox and on mobile, and even pressing Page Down/Up, dragging the scrollbar, and selecting text works as expected on desktop, just not mouse wheel. I've searched for similar issues on here, but the ones I found didn't prove useful in my case.

I believe the problem revolves around a wrapper element which is set to overflow-y: auto and has a perspective of 3px with some parallax sections. (However, removing this attribute seems to have no effect on the issue.) Another page with exactly the same wrapper element, but no parallax sections doesn't have the same problem, so it doesn't seem to be the scroll settings on the wrapper itself. Below is the full template:

<html lang="en">
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
    <!--  Tailwind CSS-->
  <link href="../../static/main/css/tailwind.css" type="text/css" rel="stylesheet" media="screen,projection"/>
  <link href="../../static/main/css/temp.css" type="text/css" rel="stylesheet" media="screen,projection"/>

</head>
<body class="h-screen">

<header> 
  <nav class="_navbar" role="navigation">
    <div class="nav-cont flex items-center">
      <div class="nav-flex-left w-1/2">
        <a id="logo-container" href="#" class="font-semibold text-white no-underline text-3xl md:text-4xl my-2 md:my-1">Brand Logo</a>
      </div>
      <div class="w-1/2 md:hidden nav-flex-right text-3xl items-center">
        <div class="my-2" onclick="openMenu()"><i id="hamburger" class="fas fa-bars cursor-pointer "></i></div>
      </div>
      <div class="w-1/2 hidden md:block">
        <ul class="nav-flex-right">
          <li class="md-nav-link"><a href="#" class="_nav-link">Nav 3</a></li>
          <li class="md-nav-link"><a href="#" class="_nav-link">Nav 2</a></li>
          <li class="md-nav-link"><a href="#" class="_nav-link active">Nav 4</a></li>
        </ul>
      </div>
    </div>
    <div id="smMenu" class="flex flex-col bg-purple-800 pt-2 pb-4 px-1 space-y-3 hidden rounded-b-lg shadow-lg">
      <a href="#" class="_nav-link active sm-nav-link hover:bg-purple-700 rounded w-1/2">Nav 1</a>
      <a href="#" class="_nav-link sm-nav-link hover:bg-purple-700 rounded w-1/2">Nav 2</a>
      <a href="#" class="_nav-link sm-nav-link hover:bg-purple-700 rounded w-1/2">Nav 3</a>
    </div>
  </nav>
</header>

<main id="main-wrapper" class="flex flex-col items-center justify-center bg-blue-300">
<!--{% block content %}-->
<div id="wrapper" class="z-20">
  <section id="top" class="section parallax bg1 non-static">
    <div class="flex items-center">
      <div class="flex-auto w-screen text-center"><h1
              class="text-center text-purple-200 text-8xl md:mt-20 md:text-9xl mb-10" style="font-family: Shoulders">
        Virtual Practice</h1>
        <h1 class="text-2xl font-semibold md:text-6xl shoulders-bold">Time for a tech makeover?</h1></div>
    </div>
  </section>
  <section id="middle" class="section mb-10 bg-gray-200 shadow-lg ">
    <div class="container mx-auto">
      <div class="flex justify-center items-center">
        <div class="flex flex-col space-y-4 p-4 md:space-y-0 md:space-x-4 md:py-0 md:px-4 md:flex-row text-purple-500">
          <div class="flex-auto barlow bg-white rounded-lg p-4 shadow-lg">
            <div class="text-center shoulders-bold"><i class="fas fa-hands-helping text-5xl mb-2"></i>
              <h1 class="mb-5 font-semibold text-purple-800 text-2xl">Title 1</h1></div>
            <p class="text-justify">Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Morbi quis commodo odio aenean sed adipiscing. Consequat interdum varius sit amet mattis vulputate. Fringilla urna porttitor rhoncus dolor purus non enim praesent. In cursus turpis massa tincidunt dui ut ornare lectus sit. Fermentum iaculis eu non diam phasellus vestibulum. Malesuada fames ac turpis egestas maecenas pharetra. Dignissim convallis aenean et tortor at risus viverra adipiscing. Eu nisl nunc mi ipsum faucibus vitae aliquet. Mi ipsum faucibus vitae aliquet nec ullamcorper sit amet. Elementum nisi quis eleifend quam. Euismod elementum nisi quis eleifend quam adipiscing vitae. Pulvinar mattis nunc sed blandit. Ipsum dolor sit amet consectetur adipiscing elit.</p></div>
          <div class="flex-auto barlow rounded-lg p-4 bg-white shadow-lg">
            <div class="text-center shoulders-bold"><i class="fas fa-laptop-house text-5xl mb-2"></i>
              <h1 class="mb-5 font-semibold text-purple-800 text-2xl">Title 2</h1></div>
            <p class="text-justify">Condimentum vitae sapien pellentesque habitant morbi. Sagittis orci a scelerisque purus semper eget duis at tellus. Sit amet nulla facilisi morbi tempus iaculis. Magna eget est lorem ipsum dolor sit amet consectetur adipiscing. Mauris pharetra et ultrices neque ornare. Ut tellus elementum sagittis vitae. Ut tristique et egestas quis. Ut porttitor leo a diam sollicitudin tempor id eu nisl. Quam adipiscing vitae proin sagittis nisl. Enim eu turpis egestas pretium aenean. Sollicitudin tempor id eu nisl. Turpis in eu mi bibendum neque. Sed viverra tellus in hac habitasse platea dictumst. Id venenatis a condimentum vitae. Enim neque volutpat ac tincidunt vitae semper quis lectus nulla. Proin libero nunc consequat interdum varius sit amet mattis. Scelerisque mauris pellentesque pulvinar pellentesque habitant morbi. Tincidunt arcu non sodales neque sodales ut etiam sit. Sed vulputate mi sit amet mauris commodo quis imperdiet massa.</p></div>
          <div class="flex-auto barlow bg-white rounded-lg p-4 shadow-lg">
            <div class="text-center shoulders-bold"><i class="fas fa-weight-hanging text-5xl mb-2"></i>
              <h1 class="mb-5 font-semibold text-purple-800 text-2xl">Title 3</h1></div>
            <p class="text-justify">Facilisis magna etiam tempor orci eu lobortis. Malesuada fames ac turpis egestas maecenas pharetra. Mollis aliquam ut porttitor leo. Viverra tellus in hac habitasse platea dictumst vestibulum rhoncus est. In hendrerit gravida rutrum quisque non tellus orci. Ac turpis egestas integer eget aliquet nibh praesent tristique magna. Egestas erat imperdiet sed euismod nisi porta lorem. Porttitor lacus luctus accumsan tortor posuere. Nam aliquam sem et tortor consequat. Cursus turpis massa tincidunt dui ut ornare. Amet consectetur adipiscing elit duis tristique sollicitudin nibh sit. Augue neque gravida in fermentum et sollicitudin ac. Vel orci porta non pulvinar neque laoreet suspendisse interdum. Velit ut tortor pretium viverra suspendisse potenti.</p></div>
        </div>
      </div>
    </div>
  </section>
  <section id="bottom" class="section h-1/2 parallax bg2 non-static">
    <div class="flex flex-col w-screen text-center px-4"><h1 class="flex-auto text-3xl font-semibold shoulders-bold">Sagittis purus sit amet volutpat consequat mauris nunc.</h1>
      <div class="flex flex-auto my-10 justify-center space-x-4 md:space-x-20">
        <a href="tel:+123123123123" class="callout-btn">Call Now
        </a>
        <a href="#" class="callout-btn">Contact
            Online
        </a>
      </div>
    </div>
  </section>
  <section id="footer" class="bg-gray-200 shadow-lg" style="min-height: 30vh">
    <div class="container mx-auto">
      <div class="flex justify-center items-center">
        <div class="flex flex-col items-center space-y-4 p-4 md:space-y-0 md:space-x-4 md:py-0 md:px-4 md:flex-row text-purple-500 my-3">
          <div class="flex-auto items-center bg-white rounded-lg p-4 shadow-lg">
            <div class="text-center">
              <h1 class="mb-5 font-semibold text-purple-800 text-2xl shoulders-bold">More reasons to choose us:</h1></div>
              <p>Ornare lectus sit amet est placerat in egestas erat. Orci nulla pellentesque dignissim enim sit amet venenatis urna. Imperdiet proin fermentum leo vel orci porta. Sed lectus vestibulum mattis ullamcorper velit sed ullamcorper. Neque ornare aenean euismod elementum. Aliquet nec ullamcorper sit amet. Vel facilisis volutpat est velit egestas dui id ornare. Diam vel quam elementum pulvinar etiam non quam lacus suspendisse. Id ornare arcu odio ut sem. Mauris nunc congue nisi vitae suscipit tellus mauris a diam. Maecenas sed enim ut sem viverra aliquet eget. Vel fringilla est ullamcorper eget. Nunc id cursus metus aliquam. Id nibh tortor id aliquet lectus proin nibh. Ipsum faucibus vitae aliquet nec ullamcorper sit.</p>
            </div>
          </div>
        </div>
      </div>
    </div>
  </section>
</div>
<!--{% endblock content %}-->
</main>

<footer id="footer" class="flex justify-center bg-gray-100 shadow-inner" style="max-height: 6vh; z-index: 9999"><div class="flex items-center container justify-between py-3"><p>Copyright &copy; Brand 2020</p><p>?<a class="brown-text text-lighten-3" href="http://google.com">Goigyle</a> 2021</p></div>
</footer>
  <script
              src="https://code.jquery.com/jquery-3.5.1.slim.min.js"
              integrity="sha256-4+XzXVhsDmqanXGHaHvgh1gMQKX40OUvDEBTu8JcmNs="
              crossorigin="anonymous"></script>
  <script type="application/javascript" src="../../static/main/js/main.js"></script>
</body>
</html>

and the relevant CSS:

body {
    overflow: auto;
}

#main-wrapper {
  overflow-y: hidden;
  overflow-x: hidden;
  width: 100vw;
  height: 94vh;
  padding-top: 64px;
}

#wrapper {

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Found a workaround. Adding transform: translateZ(0) to my main content sets the user input to that instead and I can scroll again.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...