2017-09-26 7 views
0

J'ai créé une zone défilante et je suis en train d'ajouter une barre de défilement sous les images (la barre de défilement bleu dans l'image liée)FramerJS - scrollbar horizontale avec le composant de défilement

code

que j'ai actuellement la zone défilante .

scroll = new ScrollComponent 
opacity: 1.00 
shadowBlur: 0 
scroll.size = screen 
Info.parent = scroll.content 
scroll.scrollVertical = false 

Scroll

+0

On ne sait pas que ce problème ou la question que vous avez rencontré. – Steven

Répondre

0

Je pense que vous essayez de faire une barre de défilement qui se déplace avec le défilement et montre à quel point le long de l'utilisateur a fait défiler, non? est ici un code comment faire:

scrollbar.parent = scroll 
# First make the width of the scrollbar relative to the size of the content. 
scrollbar.width = (scroll.width/scroll.content.width) * scroll.width 
# When the scroll is moved 
scroll.onMove -> 
    # Calculate the width that we should scroll over 
    width = scroll.content.width - scroll.width 
    # Calculate the percentage that has currently been scrolled 
    percentage = scroll.scrollX/width 
    # Calculate how much space there for the scrollbar to move in 
    freeSpace = scroll.width - scrollbar.width 
    # Set the position of the scrollbar relative to the free space and the percentage scrolled 
    scrollbar.x = freeSpace * percentage 

Un exemple complet est ici: https://framer.cloud/QtcLD