# How can I apply this source code in page?

**URL:** <https://forum.wixstudio.com/t/how-can-i-apply-this-source-code-in-page/69763>\
**Category:** Ask the community\
**Tags:** question, code, wix, wix-studio\
**Created:** [March 21, 2025, 8:42am UTC](https://forum.wixstudio.com/t/how-can-i-apply-this-source-code-in-page/69763 "2025-03-21T08:42:51Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![user5396](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/user5396/32/106652_2.png) [@user5396](https://forum.wixstudio.com/u/user5396)\
**Post date:** [March 21, 2025, 8:42am UTC](https://forum.wixstudio.com/t/how-can-i-apply-this-source-code-in-page/69763/1 "2025-03-21T08:42:51Z")

</div>

[[Clearly ask your question.]](https://codepen.io/jh91/pen/oNYJLXW)  
This is One-page scrolling code.

```javascript
$w.onReady(function () {
    console.log('onready');
    const Slider = function(pages) {
    let slides = [],
        count = 0,
        current = 0,
        touchstart = 0,
        animation_state = false;
    const init = () => {
      slides = pages.children;
      count = slides.length;
      for(let i = 0; i < count; i++) {
        slides[i].style.bottom = -(i * 100) + '%';
      }
    }
    const gotoNum = (index) => {
      if((index != current) && !animation_state) {
        animation_state = true;
        setTimeout(() => animation_state = false, 500);
        current = index;
        for(let i = 0; i < count; i++) {
          slides[i].style.bottom = (current - i) * 100 + '%';
        }
      }
    }
    const gotoNext = () => current < count - 1 ? gotoNum(current + 1) : false;
    const gotoPrev = () => current > 0 ? gotoNum(current - 1) : false;
    pages.ontouchstart = (e) => touchstart = e.touches[0].screenY;
    pages.ontouchend = (e) => touchstart < e.changedTouches[0].screenY ? gotoPrev() : gotoNext();
    pages.onmousewheel = pages.onwheel = (e) => e.deltaY < 0 ? gotoPrev() : gotoNext();
    init();
  }
  let pages = $w('.pages');
  let slider = new Slider(pages)
});

```

It’s Not Working. What’s problem?  
‘pages’ class is exists.

This url is my test page.

> **[scrollingPage | TLT](https://willryu.wixstudio.com/timelesslandmark/blank-2?rc=test-site)**

**Product:**  
Wix Editor

---

<div class="post-metadata">

**Author:** ![thomasj](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/thomasj/32/30791_2.png) [@thomasj](https://forum.wixstudio.com/u/thomasj)\
**Post date:** [March 24, 2025, 5:20pm UTC](https://forum.wixstudio.com/t/how-can-i-apply-this-source-code-in-page/69763/2 "2025-03-24T17:20:40Z")

</div>

It seems like you are attempting to do standard DOM manipulation within Page Code.

While you can use JavaScript and CSS on sites built on Studio, it is typically done through using the [$w API](https://dev.wix.com/docs/velo/velo-only-apis/$w/$w) which targets [Wix Page Elements](https://dev.wix.com/docs/velo/articles/getting-started/working-with-page-elements) by ID or Type.
