IE (!) Исправлены прокрутки элементов при прокрутке (колесо прокрутки и клавиатура) - PullRequest
2 голосов
/ 09 апреля 2020

Проверьте этот код в IE11! Это урезанная версия сложной страницы, которая хорошо работает во всех браузерах, кроме IE11. Мне нужно поддержать этот браузер.

.theme-layout {
  display: -webkit-box;
  display: flex;
  -webkit-box-orient: vertical;
  -webkit-box-direction: normal;
          flex-direction: column;
  height: 100vh;
  max-height: 100vh;
}

.theme-content {
  -webkit-box-ordinal-group: 2;
          order: 1;
  width: 100%;
  -webkit-box-flex: 1;
          flex-grow: 1;
  display: -webkit-box;
  display: flex;
  -webkit-box-orient: horizontal;
  -webkit-box-direction: normal;
          flex-direction: row;
  flex-wrap: nowrap;
  -webkit-box-align: stretch;
          align-items: stretch;
  position: relative;
}

.theme-main {
  flex-basis: 100%;
  -webkit-box-ordinal-group: 3;
          order: 2;
}

.composite-page {
  padding-bottom: 7.5rem;
}

.composite-page-background {
  margin: 0;
}
.composite-page-background picture {
  position: fixed;
  z-index: -1;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  display: -webkit-box;
  display: flex;
  -webkit-box-orient: horizontal;
  -webkit-box-direction: normal;
          flex-direction: row;
  flex-wrap: nowrap;
  -webkit-box-align: stretch;
          align-items: stretch;
}
.composite-page-background picture img {
  -o-object-fit: cover;
     object-fit: cover;
  -o-object-position: 50% 50%;
     object-position: 50% 50%;
  width: 100%;
}
.composite-page-background picture:after {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  background-image: -webkit-gradient(linear, left top, left bottom, color-stop(-10%, #0c6158), color-stop(60%, transparent));
  background-image: linear-gradient(to bottom, #0c6158 -10%, transparent 60%);
}

.theme-paragraph-section {
  height: calc(100vh - 7.5rem);
  display: -webkit-box;
  display: flex;
  scroll-snap-align: start;
}
@media screen and (max-width: 768px) {
  .theme-paragraph-section {
    height: auto;
  }
}
.theme-paragraph-section:target {
  -webkit-animation: theme-paragraph-section-blink 1.3s;
          animation: theme-paragraph-section-blink 1.3s;
}
@media (prefers-reduced-motion: reduce) {
  .theme-paragraph-section:target {
    -webkit-animation: none;
            animation: none;
  }
}
.theme-paragraph-section:before, .theme-paragraph-section:after {
  content: "";
  -webkit-box-flex: 1;
  flex-grow: 1;
  flex-shrink: 1;
  flex-basis: calc(45rem / 2);
  pointer-events: none;
}
<div class="theme-layout">
  <div class="theme-content">
    <main class="theme-main" id="main-content" role="main">
      <div>
        <div id="block-mainpagecontent">
          <article class="composite-page">
            <figure class="composite-page-background">
              <picture>
                <source media="(min-width: 1601px)" srcset="https://picsum.photos/id/1/1920/1080">
                <source media="(min-width: 1381px)" srcset="https://picsum.photos/id/1/1600/900">
                <source media="(min-width: 1181px)" srcset="https://picsum.photos/id/1/1380/777">
                <source media="(min-width: 901px)" srcset="https://picsum.photos/id/1/1180/664">
                <source media="(min-width: 611px)" srcset="https://picsum.photos/id/1/900/507">
                <source media="(max-width: 610px)" srcset="https://picsum.photos/id/1/610/1084">
                <img src="https://picsum.photos/id/1/900/507">

              </picture>
            </figure>
            <div class="theme-paragraph-section" id="paragraph-45">
              Dummy Content<br><br><br>
              Dummy Content<br><br><br>
              Dummy Content<br><br><br>
              Dummy Content<br><br><br>
              Dummy Content<br><br><br>
              Dummy Content<br><br><br>
              Dummy Content<br><br><br>
              Dummy Content<br><br><br>
              Dummy Content<br><br><br>
              Dummy Content<br><br><br>
              Dummy Content<br><br><br>
              Dummy Content<br><br><br>
              Dummy Content<br><br><br>
              Dummy Content<br><br><br>
              Dummy Content<br><br><br>
              Dummy Content<br><br><br>
              Dummy Content<br><br><br>
              Dummy Content<br><br><br>
              Dummy Content<br><br><br>
              Dummy Content<br><br><br>
              Dummy Content<br><br><br>
              Dummy Content<br><br><br>
              Dummy Content<br><br><br>
              Dummy Content<br><br><br>
              Dummy Content<br><br><br>
              Dummy Content<br><br><br>
            </div>
          </article>
        </div>
      </div>
    </main>
  </div>
</div>

Поскольку stackoverflow больше не поддерживает IE11, я ссылаюсь на представление отладки codepen, которое вы можете открыть в IE11: https://cdpn.io/HerrSerker/debug/748ff2e947bdc668a7af47e6eeb0872a

Этот код содержит адаптивное изображение, которое должно охватывать все окно и оставаться фиксированным при прокрутке. Перед этим изображением находится некоторый фиктивный контент, который заставляет страницу прокручиваться.

Теперь проблема: когда я прокручиваю в Inte rnet Explorer 11, фиксированное изображение на фоне не фиксируется, а переходит вверх и вниз, но только при прокрутке с помощью колеса прокрутки мыши или клавиатуры ( SPACE , UP , DN , PGUP или PGDN ). Если я перетаскиваю полосу прокрутки, фиксированный элемент остается фиксированным, как и должно быть.

Я сделал GIF из скринкаста, чтобы продемонстрировать проблему enter image description here

1 Ответ

1 голос
/ 09 апреля 2020

Я пытаюсь проверить ваш пример кода в браузере IE 11 и вижу там проблему.

Я пытаюсь проверить код CSS и обнаружил, что position: относительный; в .theme-content CSS класс, вызывающий эту проблему.

Если вы удалите или прокомментируете позицию : относительный; , тогда проблема может быть решена.

Вывод в браузере IE 11:

enter image description here

...