Vorbly <Code>

CODING MADE EASY WITH VORBLY

WIX CODE SCROLL TO SECTION (PAGE HEIGHT)

Need to scroll to a certain section on your webpage? This tutorial will show you how to add a ScrollTo function using Wix Code. Scroll To a certain section of your desktop and mobile webpages without any layout issues. We will provide you with the webpage elements and sample codes required to implement this feature.

THE DEMO

1/2

THE ELEMENTS

The Page

Strip Elements​

  • Container Box: #box1

  • Text Element: #text1

Button Elements

  • ScrollTo Strip 1: #Button1

  • ScrollTo Strip 2: #Button2

  • ScrollTo Strip 3: #Button3

THE CODE

Page Code

import wixWindow from 'wix-window';

 

export function Button1_click(event) {

    wixWindow.scrollTo(0, 110);

}

 

export function Button2_click(event) {

    wixWindow.scrollTo(0, 630);

}

 

export function Button3_click(event) {

    wixWindow.scrollTo(0, 1150);

}

Negative Example

export function Button1_click(event) {

    $w('#Strip1').scrollTo();

}

 

export function Button2_click(event) {

    $w('#Strip2').scrollTo();

}

 

export function Button3_click(event) {

    $w('#Strip3').scrollTo();

}

COMMENTS

I'm a paragraph. Click here to add your own text and edit me. It's easy.

WEB DESIGN & DEVELOPMENT SOLUTIONS

GET PROFESSIONAL HELP