Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Web and WebWorks Development

Reply
New Contributor
appleseed26
Posts: 2
Registered: ‎04-28-2013
My Device: BB Bold 9000
My Carrier: Docomo

Scroll event bbui webworks - check bottom of page and bounce effect

[ Edited ]

I'm working on an app in Blackberry using BBUI that loads search results from twitter. But I have problem loading new results when the user reached the bottom of the page.

 

 

 

$(window).scroll(function(){
        if ($(window).scrollTop() == $(document).height()-$(window).height()){
                  alert("We're at the bottom of the page!!");               
        }
    });

It works in a normal webpage but it is not working in Ripple emulator for BBZ10. I want to have something that will load data when the bottom of the page is reached. Like the one in twitter/facebook app that loads results automatically when the bottom of the page is reached.

Also I want to have something that will refresh results when user swipe down.

 

Please use plain text.
Administrator
astanley
Posts: 1,382
Registered: ‎07-02-2009
My Device: BlackBerry Bold 9900
My Carrier: Bell

Re: Scroll event bbui webworks - check bottom of page and bounce effect

Is your scroll event handler firing?  You should be able to set a break point in web inspector to confirm.

 

If so, I suspect the issue has to do with the values of the height() methods being returned when called from within Ripple.  Ripple emulates screen dimensions, and I'm curious if the wrong values are being captured in your scroll() method (would prevent the alert statement from firing).

Follow me on Twitter: @n_adam_stanley
-------------------------------------------------------------------------------------------------------------------------
Your app doesn't work? Use BlackBerry remote web inspector to find out why.
Please use plain text.
New Contributor
appleseed26
Posts: 2
Registered: ‎04-28-2013
My Device: BB Bold 9000
My Carrier: Docomo

Re: Scroll event bbui webworks - check bottom of page and bounce effect

[ Edited ]

It's not firing, so I tried

 

document.addEventListener("touchmove", function(event) {
    console.log($(document).scrollTop());
    console.log(window.pageYOffset);
    console.log($(document).height());
}, false);

 

But this event only fires when I click on the emulator, I'm not sure whats the real scenario in real device but I think this will work because scrolling in the device is "touchmove". The only problem is that the values of my scroll offset is always 0 :smileysad:(. Is the property for scroll offset not the same on the device?

 

BTW, I'm using a scroll panel.. This is my html

 

<div data-bb-type="title" data-bb-caption="Title"></div>
<div data-bb-type="scroll-panel" style="height:100%" id="scroll">

<!--Contents here-->

</div>

Please use plain text.