ons-scroller


  • Onsen UI

    Makes the content inside this tag scrollable.

    Click here to see the original article



  • How to go bottom of the scroll on start?


  • Onsen UI

    @serdarde Right as you would do it for a normal div, check this question.



  • @fran-diox: thanks fran. I though that I can find a attribute for this :) but of course it is enough:

    I think I will use that funny one: $(’#scroll’).scrollTop(1000000);



  • @Fran-Diox @serdarde, I have this code

            var onsScroller = $('#scroller');
            alert(onsScroller[0].scrollTop);
            // code to insert some elements here
            onsScroller[0].scrollTop = 1000000;
            alert(onsScroller[0].scrollTop);
    

    both alerts display 0.
    I also tried

            var onsScroller = $('#scroller');
            alert(onsScroller.scrollTop());
            // code to insert some elements here
            onsScroller.scrollTop(1000000);
            alert(onsScroller.scrollTop());
    

    with exactly same result. Please advise. Thank you.



  • I found an example by @argelius here:
    https://github.com/OnsenUI/OnsenUI/issues/748

    My working code is:

            var onsScroller = $('#scroller  > .ons-scroller__content');
            alert(onsScroller[0].scrollTop);
            // code to insert some elements here
            onsScroller[0].scrollTop = 1000000;
            alert(onsScroller[0].scrollTop);
    

    The last alert will display current scrollTop value, not 1000000.
    Thank you.



  • Did I read somewhere that the scroller was to be deprecated?


  • Onsen UI

    @munsterlander Yes, it’s already removed in the last betas. It was just adding some simple CSS so it doesn’t make sense to have a component like that. From now on you can use class="scroller"



  • @Fran-Diox Ah, ok. I am running the latest beta and it wasn’t working. I needed to get a carousel-item to scroll and the class fixed that. Awesome! Sometimes its hard to find those one-off comments in the GH issues / PR’s. Do you know when the docs will be rebuilt?


  • Onsen UI

    @munsterlander Hopefully within the next two or three weeks.



  • @Fran-Diox Thats great! My problem is, I get all the GH updates in email so I read those and then I forget which issue I read, so sometimes going back and finding the new way to do something is difficult. I will say though, I have learned so much about Onsen reading the internal comments of you guys working on Onsen. It is so much fun right now!

    You guys are super impressive and I am learning a lot - even on coding things I have done for years. Just super amazing stuff, :bowtie:


Log in to reply