asafdav / ng-scrollbar

A custom scrollbar written in pure AngularJS
MIT License
187 stars 70 forks source link

Add some API #10

Open paveleremin opened 10 years ago

paveleremin commented 10 years ago

Is it possible do something like this: $document.find('.ngsb-wrap').scrollTop(10); ?

asafdav commented 10 years ago

Can you please elaborate ? What are you trying to achieve ?

On Wed, Jun 4, 2014 at 4:33 PM, Pavel Eremin notifications@github.com wrote:

Is it possible do something like this: $document.find('.ngsb-wrap').scrollTop(10); ?

— Reply to this email directly or view it on GitHub https://github.com/asafdav/ng-scrollbar/issues/10.

paveleremin commented 10 years ago

@asafdav I try set scroll position after page loaded. Is it possible?

paveleremin commented 10 years ago

simpe example: add something like this into directive:

scope.scrollTo = function(intTop) { page.top = -Math.round(intTop); dragger.top = -Math.round(page.top / page.scrollHeight * page.height); buildScrollbar(); };

cause you used the private variables inside :(

asafdav commented 10 years ago

Hi Pavel, It looks like a great idea, Do you want to add it and pull request or shall I do it ?

paveleremin commented 10 years ago

@asafdav I think my solution very simple. Maybe you can implement some real api. Refactoring variables and so on. Would like to use it: $document.find('.scroll-block-with-dirrective').scrollTo(123); instead my solution: $document.find('.scroll-block-with-dirrective').scope().scrollTo(123); for example, seems this logic use angular-strap