Skip to content
Snippets Groups Projects
Select Git revision
  • 419d6ab9b5ba21ddab18095eef0515a747fe9e40
  • main default protected
2 results

_carousel.scss

Blame
  • _carousel.scss 5.45 KiB
    // Notes on the classes:
    //
    // 1. .carousel.pointer-event should ideally be pan-y (to allow for users to scroll vertically)
    //    even when their scroll action started on a carousel, but for compatibility (with Firefox)
    //    we're preventing all actions instead
    // 2. The .carousel-item-start and .carousel-item-end is used to indicate where
    //    the active slide is heading.
    // 3. .active.carousel-item is the current slide.
    // 4. .active.carousel-item-start and .active.carousel-item-end is the current
    //    slide in its in-transition state. Only one of these occurs at a time.
    // 5. .carousel-item-next.carousel-item-start and .carousel-item-prev.carousel-item-end
    //    is the upcoming slide in transition.
    
    .carousel {
      position: relative;
    }
    
    .carousel.pointer-event {
      touch-action: pan-y;
    }
    
    .carousel-inner {
      position: relative;
      width: 100%;
      overflow: hidden;
      @include clearfix();
    }
    
    .carousel-item {
      position: relative;
      display: none;
      float: left;
      width: 100%;
      margin-right: -100%;
      backface-visibility: hidden;
      @include transition($carousel-transition);
    }
    
    .carousel-item.active,
    .carousel-item-next,
    .carousel-item-prev {
      display: block;
    }
    
    .carousel-item-next:not(.carousel-item-start),
    .active.carousel-item-end {
      transform: translateX(100%);
    }
    
    .carousel-item-prev:not(.carousel-item-end),
    .active.carousel-item-start {
      transform: translateX(-100%);
    }
    
    
    //
    // Alternate transitions
    //
    
    .carousel-fade {
      .carousel-item {
        opacity: 0;
        transition-property: opacity;
        transform: none;
      }
    
      .carousel-item.active,
      .carousel-item-next.carousel-item-start,
      .carousel-item-prev.carousel-item-end {
        z-index: 1;