Search code examples
cssinternet-explorer-11marquee

CSS Scrolling Marquee Issues in IE11


I got a scrolling marquee going similar to what Apple has on their Apple Arcade Page towards the bottom of the page. https://www.apple.com/apple-arcade/

I got it working but in ie 11 it's really slow and doesn't cycle through the entire marquee like it dose in the other browser. I was trying to achieve this with just pure CSS but maybe it's not possible for ie11 or I'm just missing something?

Code Pen link: https://codepen.io/devi8/pen/89e45e26d38f173d87993e167a5f4695

<style>
.marquee--container {
  width: 100%;
  padding: 1em;
  display: flex;
  align-items: center;
  box-sizing: border-box;
  overflow: hidden;
}

.marquee--content {
  display: flex;
}

.scroll {
  animation: scroll 20s linear infinite;
}

.scroll.reverse {
  animation-direction: reverse;
}

.marquee--content:hover {
  animation-play-state: paused;
}

.marquee--item {
  display: block;
  margin: 0 .6rem;
  transition: all 0.2s ease;
}

.marquee--item:hover {
  background: rgba(255,255,255,0.5);
  transform: scale(1.03);
  cursor: pointer;
}

.marquee--item img {
  border-radius: 1rem;
}

@keyframes scroll {
  0% {
    transform: translateX(0);
  }
  100% {
    transform: translateX(-50%);
  }
}
</style>

<section class="marquee--container">
  <div class="marquee--content scroll">
    <article class="marquee--item">
       <img src="https://via.placeholder.com/600x300?text=01" alt="image">
    </article>
    <article class="marquee--item">
       <img src="https://via.placeholder.com/600x300?text=02" alt="image">
    </article>
    <article class="marquee--item">
       <img src="https://via.placeholder.com/600x300.jpg/f00/fff?text=03" alt="image">
    </article>
    <article class="marquee--item">
       <img src="https://via.placeholder.com/600x300?text=04" alt="image">
    </article>
    <article class="marquee--item">
       <img src="https://via.placeholder.com/600x300?text=05" alt="image">
    </article>
    <article class="marquee--item">
       <img src="https://via.placeholder.com/600x300.jpg/1CACF4/fff?text=06" alt="image">
    </article>
    <article class="marquee--item">
       <img src="https://via.placeholder.com/600x300?text=01" alt="image">
    </article>
    <article class="marquee--item">
       <img src="https://via.placeholder.com/600x300?text=02" alt="image">
    </article>
    <article class="marquee--item">
       <img src="https://via.placeholder.com/600x300.jpg/f00/fff?text=03" alt="image">
    </article>
    <article class="marquee--item">
       <img src="https://via.placeholder.com/600x300?text=04" alt="image">
    </article>
    <article class="marquee--item">
       <img src="https://via.placeholder.com/600x300?text=05" alt="image">
    </article>
    <article class="marquee--item">
       <img src="https://via.placeholder.com/600x300.jpg/1CACF4/fff?text=06" alt="image">
    </article>
  </div>
</section>

Solution

  • Instead display:flex to keep every thing on a single line, you can use display:table/table-cell well implemented:

    https://jsbin.com/cobiyugafo/1/edit (runing & editable from Internet Explorer 11 )

    .marquee--container {
      width: 100%;
      padding: 1em;
      display: flex;
      align-items: center;
      box-sizing: border-box;
      overflow: hidden;
      min-width:0;
    }
    
    .marquee--content {
      display: table; /* <=== here */
      border-spacing:  0.6rem 0;
    }
    
    .scroll {
      animation: scroll 20s linear infinite;
    }
    
    .scroll.reverse {
      animation-direction: reverse;
    }
    
    .marquee--content:hover {
      animation-play-state: paused;
    }
    
    .marquee--item {
      display: table-cell; /* <=== here */
      /* margin replaced by border-spacing */
      transition: all 0.2s ease;
    }
    
    .marquee--item:hover {
      background: rgba(255,255,255,0.5);
      transform: scale(1.03);
      cursor: pointer;
    }
    
    .marquee--item img {
      border-radius: 1rem;
    }
    
    @keyframes scroll {
      0% {
        transform: translateX(0);
      }
      100% {
        transform: translateX(-50%);
      }
    }