@import '../../styles/index.less';

@scroll-prefix-cls: ~'@{open-prefix}-scroll';

.@{scroll-prefix-cls}-image {
  width: inherit;
  overflow: hidden;
  position: relative;

  &:hover {
    .@{scroll-prefix-cls}-left-right-icon span {
      display: inline-block;
    }

    .@{scroll-prefix-cls}-left-right-icon
      > .@{scroll-prefix-cls}-arrow-visible-none {
      display: none;
    }
  }

  .@{scroll-prefix-cls}-left-right-icon {
    position: absolute;
    width: 100%;

    span {
      cursor: pointer;
      z-index: 11;
      position: absolute;
      display: none;
      background-color: rgba(0, 0, 0, 0.3);
      top: 0;
      bottom: 0;
      margin: auto;
      height: 44px;
      line-height: 50px;
      width: 26px;
      text-align: center;
      color: white;
      transition: 0.2s;

      &:hover {
        background-color: rgba(0, 0, 0, 0.7);
      }

      &::before {
        content: '';
        background: url('./static/jiantou.png') no-repeat;
        height: 20px;
        width: 20px;
        position: absolute;
        background-size: 17px;
        bottom: 10px;
        right: 3px;
      }
    }

    .@{scroll-prefix-cls}-prev-icon {
      left: 0;
      line-height: inherit;
      border-radius: 0 26px 26px 0;
    }

    .@{scroll-prefix-cls}-next-icon {
      right: 0;
      line-height: inherit;
      border-radius: 26px 0 0 26px;

      &::before {
        transform: rotateY(180deg);
      }
    }
  }

  ul {
    z-index: 10;
    height: inherit;
    white-space: nowrap;
    position: absolute;
    //width: 104%;
    transition: all 1s ease-in-out 0s;
    -moz-transition: all 1s ease-in-out 0s;
    -webkit-transition: all 1s ease-in-out 0s;
    -o-transition: all 1s ease-in-out 0s;
    margin-right: -1%; //设置ul偏右-用来抵消li元素右边距1%导致的缺口

    li {
      height: 100%;
      display: inline-block;
      overflow: hidden;

      .@{scroll-prefix-cls}-img {
        border-radius: 6px;
        overflow: hidden;
        cursor: pointer;
        width: 100%;
        background: #e8e8e8;

        img {
          transition: all 0.3s;
          width: 100%;
          //height: calc(100% - 44px);
          object-fit: cover;
        }
      }

      //图片缓冲效果
      .@{scroll-prefix-cls}-image-cache {
        background: #f6f7f8;
        background-image: linear-gradient(
          90deg,
          #cce5f8 0,
          #fdfdfd 20%,
          #cce5f8 40%,
          #f6f7f8
        );
        background-repeat: no-repeat;
        background-size: 800px 304px;
        -webkit-animation-duration: 1s;
        animation-duration: 1s;
        -webkit-animation-fill-mode: forwards;
        animation-fill-mode: forwards;
        -webkit-animation-iteration-count: infinite;
        animation-iteration-count: infinite;
        -webkit-animation-name: mymove;
        animation-name: mymove;
        -webkit-animation-timing-function: linear;
        animation-timing-function: linear;
      }

      &:hover {
        img {
          transform: scale(1.07);
        }
      }
    }
  }

  .@{scroll-prefix-cls}-ul-ease-in-out {
    transition-timing-function: ease-in-out;
    -o-transition-timing-function: ease-in-out;
    -webkit-transition-timing-function: ease-in-out;
  }

  .@{scroll-prefix-cls}-ul-linear {
    transition-timing-function: linear;
    -webkit-transition-timing-function: linear;
    -o-transition-timing-function: linear;
  }

  .@{scroll-prefix-cls}-ul-ease {
    transition-timing-function: ease;
    -webkit-transition-timing-function: ease;
    -o-transition-timing-function: ease;
  }

  .@{scroll-prefix-cls}-ul-ease-in {
    transition-timing-function: ease-in;
    -webkit-transition-timing-function: ease-in;
    -o-transition-timing-function: ease-in;
  }

  .@{scroll-prefix-cls}-ul-ease-out {
    transition-timing-function: ease-out;
    -webkit-transition-timing-function: ease-out;
    -o-transition-timing-function: ease-out;
  }

  .@{scroll-prefix-cls}-text {
    margin-top: 5px;
    width: 100%;
    max-height: 44px;
    //height: 44px;
    overflow: hidden;
    z-index: 10;

    &-title {
      cursor: pointer;

      a {
        height: 22px;
        white-space: nowrap;
        text-overflow: ellipsis;
        overflow: hidden;
        max-height: 22px;
        line-height: 22px;
        font-size: 16px;
        display: block;
        color: #0a0909;
      }
    }

    .@{scroll-prefix-cls}-desc {
      color: #959595;
      margin-top: 4px;
      height: 20px;
      line-height: 20px;
      font-size: 14px;
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
    }
  }
}

@keyframes mymove {
  from {
    background-position: right;
  }

  to {
    background-position: left;
  }
}
