Jump to content
Search Community

Daria Vishnyakova

Members
  • Posts

    4
  • Joined

  • Last visited

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

Daria Vishnyakova's Achievements

  1. hello, Jack. Thank you very much for help!! Your decision looks so accurate. var availableWidth = window.innerWidth, hidenWidth = thisAnimWrap.scrollWidth - window.innerWidth; const snapArray = items.reduce((acc, item, index) => { const sum = acc[index - 1] ? acc[index - 1] : 0, multiplier = 1000; availableWidth = availableWidth - item.scrollWidth; if ((availableWidth) > 0) return [...acc, 0]; else if (availableWidth < 0 && availableWidth > -item.scrollWidth) return [...acc, Math.round((Math.abs(availableWidth)/hidenWidth) * multiplier) / multiplier]; availableWidth = item.scrollWidth; var newValue = Math.round((sum + (availableWidth / hidenWidth)) * multiplier) / multiplier; return [...acc, newValue]; }, []) My thoughts was enough only for this solution, and then pass an array to snap object snap: { snapTo: snapArray, inertia: true, duration: 0.5, delay: 0, },
  2. Yes, exactly about snapping. I am trying to snap from section to section and for horizontal sections from item to item, but all time it goes further then on 1 item
  3. Hello, Cassie. Strange behaviour of scroll is: when you scrolling sections go further. Screen can be scrolled to the middle of horizontal section, or just to the middle of the blank section (just one with text). When you scrolling horizontally it must appears new item from the right side, then next item from the right side, but now onScroll screen goes to the middle of horizontal section... this is strange
  4. Hello Green Sock community. I have an issue with scroll behaviour, and I hope that you can help me to handle it. https://codepen.io/Dasha_Vi/pen/NWyYqBE Here is just a simple example of scroll, I was trying to give a user possibility to scroll only with his wheel (in one direction). The main idea was: when user scroll - the page must scrolls by sections, and when it is a horizontal scroll page must be scrolled by items (not partially, but fully). Now I faced with a strange behaviour of animation when scrolling, I think that something is wrong with my code, but can't get what exactly.
×
×
  • Create New...