GSAP ScrollTrigger 水平滚动未按预期结束

问题描述

在我的 shopify 网站上向下滚动图像时尝试水平滚动。但是 ScrollTrigger 的结尾并没有在最后一个部分/图像处结束。当最后一张图片到达浏览器的右侧时,如何修复结束函数以结束滚动触发器 there is unwanted padding

gsap.registerPlugin(ScrollTrigger);


let sections = gsap.utils.toArray(".product-image");

gsap.to(sections,{
     xPercent: -100 * (sections.length -1),ease: "none",scrollTrigger: {
      trigger: ".product-image-section",markers: true,pin: true,scrub: true,end: () => "+=" +
    document.querySelector(".product-image").offsetWidth
    }
  });
img {
  width: auto;
  height: 100%;
  border-style: solid;
  border-width: 2px;
  border-color: green;
}
.product-image-section{
   height: 73vh;
   z-index: -1;
  border-style: solid;
  border-width: 2px;
  border-color: red;
}
.container-main{
  display: flex;
  flex-wrap: wrap;
  flex-direction: column;
  height: 100%;
  width: 38%; 

}
<div class="product-image-section">
  <div class="container-main">
    {% for image0 in product.images %}

      <img class="product-image" src=" {{ image0.src | img_url: '500x' }} " alt="11954" >

    {% endfor %}
  </div>

</div>

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)

相关问答

Selenium Web驱动程序和Java。元素在(x,y)点处不可单击。其...
Python-如何使用点“。” 访问字典成员?
Java 字符串是不可变的。到底是什么意思?
Java中的“ final”关键字如何工作?(我仍然可以修改对象。...
“loop:”在Java代码中。这是什么,为什么要编译?
java.lang.ClassNotFoundException:sun.jdbc.odbc.JdbcOdbc...