Левая панель навигации перемещается вместе с содержимым в IE (приходится прокручиваться независимо) - PullRequest
2 голосов
/ 09 апреля 2019

У меня есть страница с левой панелью навигации, которую можно прокручивать. Контент также можно прокручивать. Он отлично работает в Chrome, однако в IE11 панель навигации перемещается вместе с контентом, а контент - с панелью навигации.

.wrapper {
    display: flex;
    display: -ms-flexbox;
    -ms-flex-flow: row;
    flex-flow: row;
}

    .navigation {
        position: relative;
        -ms-flex-preferred-size: 280px;
            flex-basis: 280px;
        -ms-flex-negative: 0;
            flex-shrink: 0;
        background: red;
        overflow-x: hidden;
        overflow-y: auto;
                box-shadow: 0 0 32px rgba(0, 0, 0, 0.5);
        z-index: 1;
    }

    .content {
        -ms-flex-positive: 1;
        flex-grow: 1;
        -ms-flex-negative: 1;
        flex-shrink: 1;
        -ms-flex-preferred-size: 0;
        flex-basis: 0;
        position: relative;
        width: 50%; // This makes the "content" div shrink when being resized
    }
<div class"wrapper"> 
<div class"navigation"> </div>
<div class"content"> </div>
</div>

Вот так выглядят мои классы CSS. Я пытался добавить -ms свойства стиля, но это не помогло.

похоже, что overflow-y: auto; свойство в .navigation классе не работает. Я попытался проверить и установить overflow-y:scroll в IE, и он появился, но тоже не работал. Я тоже пробовал -ms-overflow-style: scrollbar

Я знаю, что я просто не знаю, как решить эти проблемы, но это заставляет меня так ненавидеть IE, что я даже не могу описать.

Я пытался добиться того, чтобы навигация и контент прокручивались независимо весь день, и я с треском провалился.

1 Ответ

0 голосов
/ 10 апреля 2019

Я пытаюсь проверить ваш код в IE и Chrome.Основываясь на моих результатах тестирования, я обнаружил, что ваш код выдает схожие результаты в Chrome и IE, поскольку полоса прокрутки не добавляется на панель навигации и перемещается вместе с содержимым.

Результат теста вашего кода в том виде, как он естьв браузере Chrome.

enter image description here

Вы можете попробовать выполнить тест с помощью приведенного ниже кода, который может помочь вам решить проблему.

<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<style>
.col-container {
  
 
 
}
.col1 {
  float:left;
  padding: 16px;
  width:250px;
 height:400px;
  overflow: scroll;
  background:red;
  
}
.col2 {

 float:left;
  padding: 16px;
  width:250px;
  height:400px;
  overflow: scroll;
  background:yellow;
   
}
</style>
</head>
<body>


<h2>Sample page</h2>


<div class="col-container">
  <div class="col1">
    <h2>Navigation</h2>
   <ul>
  <li>Coffee</li>
  <li>Tea</li>
  <li>Milk</li>
  <li>Coffee</li>
  <li>Tea</li>
  <li>Milk</li>
  <li>Coffee</li>
  <li>Tea</li>
  <li>Milk</li>
  <li>Coffee</li>
  <li>Tea</li>
  <li>Milk</li>
  <li>Coffee</li>
  <li>Tea</li>
  <li>Milk</li>
  <li>Coffee</li>
  <li>Tea</li>
  <li>Milk</li>
</ul>  
  </div>

  <div class="col2">
    <h2>Content</h2>
    <p>Content Video provides a powerful way to help you prove your point. When you click Online Video, you can paste in the embed code for the video you want to add. You can also type a keyword to search online for the video that best fits your document.
To make your document look professionally produced, Word provides header, footer, cover page, and text box designs that complement each other. For example, you can add a matching cover page, header, and sidebar. Click Insert and then choose the elements you want from the different galleries.
Themes and styles also help keep your document coordinated. When you click Design and choose a new Theme, the pictures, charts, and SmartArt graphics change to match your new theme. When you apply styles, your headings change to match the new theme.
Save time in Word with new buttons that show up where you need them. To change the way a picture fits in your document, click it and a button for layout options appears next to it. When you work on a table, click where you want to add a row or a column, and then click the plus sign.
Reading is easier, too, in the new Reading view. You can collapse parts of the document and focus on the text you want. If you need to stop reading before you reach the end, Word remembers where you left off - even on another device.
</p>
  </div>

  
</div>

</body>
</html>

Вывод в IE 11:

enter image description here

Далее вы можете попробовать изменить кодсогласно вашему требованию.

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...