Giter Club home page Giter Club logo

Comments (2)

agranig avatar agranig commented on June 20, 2024

I figured out the part how to trigger a refresh in order to scroll to the bottom of my container div.

HTML:
<div id="mycontainer" slimscroll="slimscrollOpts"><!-- put my elements here --></div>

Controller:
$scope.slimscrollOpts = { /* my usual initialization opts for slimscroll */ }
// other code goes here
$scope.mycontent.push(newelem);
$scope.slimscrollOpts.scrollTo = myEndPosition;

At least this makes my container to always jump to the bottom with a proper myEndPosition being set, as there is a watcher on the slimscrollOpts.

However, the rail bar on the right is not updated, and if I hover it, it shows my initial position. Any idea how to update/redraw that part properly?

from angular-slimscroll.

ziscloud avatar ziscloud commented on June 20, 2024

@agranig
Thanks for your post, and I checked the source code of slimscroll, when you pass the scrollTo in the options, slimscroll jump to the content, and ignore the scroll bar, from line 120 to 140:

              if ('scrollTo' in options)
              {
                // jump to a static point
                offset = parseInt(o.scrollTo);
              }
              else if ('scrollBy' in options)
              {
                // jump by value pixels
                offset += parseInt(o.scrollBy);
              }
              else if ('destroy' in options)
              {
                // remove slimscroll elements
                bar.remove();
                rail.remove();
                me.unwrap();
                return;
              }

              // scroll content by the given offset
              scrollContent(offset, false, true);

I think set true to the the second parameter and false to the third parameter of scrollContent, then your problem will be solved, but you need your own copy of slimscroll or raise a merge request to slimscroll.

from angular-slimscroll.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.