Access to the ScrollPosition in Javascript


I’m trying to access in javascript to the scrollPosition value of a ScrollViewer when I click a Button. But I obtain a null debug…

Here is my code:


<ScrollViewer ScrollPosition="{ScrollPosition}">
<Button >
    <Clicked Handler="{ClickFunction}" />


var Observable = require("FuseJS/Observable");
var ScrollPosition = Observable();

function ClickFunction(){

module.exports = {
    ScrollPosition: ScrollPosition,
    ClickFunction: ClickFunction

How can achieve this?


Hi, sorry for the wait.

You can databind ScrollPosition like so:

ux: <ScrollViewer ScrollPosition="{scrollPos}">

js: var scrollPos = Observable([0,40]);

This lets you at least set the scrollposition from JS, but it doesn’t seem to work the other way, meaning the observable isn’t being updated when scrolling.

I’ll investigate some more on this

@Kristian Hasselknipe help me and I solve my problem. I want to call a function in javascript when my ScrollViewer reach the end or reach his max position of the Scroll position loading more elements in the scrollViewer.

Here is the code:

In UX:

  <App Theme="Basic" ClearColor="#eeeeeeff">
            <JavaScript File="MainView.js"/>
            <Rectangle Dock="Right" Width="50">
                <SolidColor ux:Name="color" Color="#f00"/>
                    <Each Count="20">
                        <Rectangle Height="100" Fill="#f0f" Margin="5"/>
                    <Text Value="End!" TextColor="#000" FontSize="30" />

                <WhileScrollable ScrollDirections="Down" Invert="true">
                    <Callback Handler="{yourJSFunction}"/>



var Observable = require('FuseJS/Observable');

function yourJSFunction() {
    debug_log("End of the ScrollPosition!");

module.exports = {
    yourJSFunction: yourJSFunction

It will be very usefull to read values like ScrollPosition in JavaScript to do thinks like that.