# Binding element state to scroll position of another element not working

**URL:** <https://community.weweb.io/t/binding-element-state-to-scroll-position-of-another-element-not-working/7520>\
**Category:** Ask us anything\
**Created:** [March 11, 2024, 11:13pm UTC](https://community.weweb.io/t/binding-element-state-to-scroll-position-of-another-element-not-working/7520 "2024-03-11T23:13:06Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Dorian](https://sea2.discourse-cdn.com/flex016/user_avatar/community.weweb.io/dorian/32/13183_2.png) [@Dorian](https://community.weweb.io/u/Dorian)\
**Post date:** [March 11, 2024, 11:13pm UTC](https://community.weweb.io/t/binding-element-state-to-scroll-position-of-another-element-not-working/7520/1 "2024-03-11T23:13:06Z")

</div>

Hi all

I’m trying to bind the state of a text element to the y scroll position of an HTML element. The formula is working correctly in the editor but when I go to preview mode, the state isn’t changing. See Loom below.Any ideas please? Thanks!

https://www.loom.com/embed/5bc629e0491a4455975ff007ab53f29a?sid=420cec2b-32c4-4261-b736-046f89054535

---

<div class="post-metadata">

**Author:** ![jptrinh](https://sea2.discourse-cdn.com/flex016/user_avatar/community.weweb.io/jptrinh/32/1493_2.png) [@jptrinh](https://community.weweb.io/u/jptrinh)\
**Post date:** [March 12, 2024, 9:24am UTC](https://community.weweb.io/t/binding-element-state-to-scroll-position-of-another-element-not-working/7520/2 "2024-03-12T09:24:20Z")

</div>

I believe that’s because the width of the content is changing. So, the values don’t match anymore (you can check that by binding the y values to a text).  
Having fixed values might not be the best solution here.

---

<div class="post-metadata">

**Author:** ![Dorian](https://sea2.discourse-cdn.com/flex016/user_avatar/community.weweb.io/dorian/32/13183_2.png) [@Dorian](https://community.weweb.io/u/Dorian)\
**Post date:** [March 12, 2024, 4:12pm UTC](https://community.weweb.io/t/binding-element-state-to-scroll-position-of-another-element-not-working/7520/3 "2024-03-12T16:12:13Z")

</div>

@jptrinh You are correct, thank you. Any other ideas as to how to make this work?

---

<div class="post-metadata">

**Author:** ![Dorian](https://sea2.discourse-cdn.com/flex016/user_avatar/community.weweb.io/dorian/32/13183_2.png) [@Dorian](https://community.weweb.io/u/Dorian)\
**Post date:** [March 18, 2024, 3:15am UTC](https://community.weweb.io/t/binding-element-state-to-scroll-position-of-another-element-not-working/7520/4 "2024-03-18T03:15:49Z")

</div>

Bumping this one in hopes someone can help me work this out. If not, guess I will be joining the office hours Tuesday! Thanks. 🙃

---

<div class="post-metadata">

**Author:** ![jptrinh](https://sea2.discourse-cdn.com/flex016/user_avatar/community.weweb.io/jptrinh/32/1493_2.png) [@jptrinh](https://community.weweb.io/u/jptrinh)\
**Post date:** [March 18, 2024, 10:34am UTC](https://community.weweb.io/t/binding-element-state-to-scroll-position-of-another-element-not-working/7520/5 "2024-03-18T10:34:19Z")

</div>

I was thinking of having a ‘watcher’ div at the end of the terms. When that watcher y position is in the screen (\> 20 for instance), then activate the checkbox. A bit like in the [Infinite scroll logic](https://www.youtube.com/watch?v=f7lM-yqWJqY&t=976s).

---

<div class="post-metadata">

**Author:** ![MatthewS](https://sea2.discourse-cdn.com/flex016/user_avatar/community.weweb.io/matthews/32/3582_2.png) [@MatthewS](https://community.weweb.io/u/MatthewS)\
**Post date:** [March 18, 2024, 2:25pm UTC](https://community.weweb.io/t/binding-element-state-to-scroll-position-of-another-element-not-working/7520/6 "2024-03-18T14:25:30Z")

</div>

@jptrinh solution should do the trick
