Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding initial page feature #8

Closed
wants to merge 8 commits into from
Closed

Adding initial page feature #8

wants to merge 8 commits into from

Conversation

diegolameira
Copy link

Hi there,

I work at Lumis [http://www.lumis.com.br] and here we'll start to use a fork of your code to our publications viewer app, whose nickname is Poligno. We found useful to set an initial scroll to an element, so I'm sending you this pull request to thank you for your code and collaborate too.

Best regards,
=P

});

$scope.goTo = function(index){
setTimeout(function() {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is setTimeout needed here? maybe $scope.$$postDigest would be enough if any delay of execution at all. What happens if the setTimeout is removed?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All right, $$postDigest might solve the problem, it was just a hacky setTimeout Zero just to run scrollTop after content loaded, waiting all DOM negotiation finishes before scrollTop, or parent height would be 0px.
I'll note this as many others under the hood and not documented useful angular features found.

…ll height checkiing if sizesPropertyExist, all noted from original author (@kamilkp)
@diegolameira diegolameira reopened this Aug 2, 2014
var scrollPosition = (sizesPropertyExists) ?
($scope.sizesCumulative[index] + $scope.offsetBefore):
(index * $scope.elementSize + $scope.offsetBefore);
$scrollParent[0].scrollTop = scrollPosition;
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One more thing. This assumes that we are using vertically stacked element. Whereas vs-repeat also supports scrolling horizontally. Instead of referencing scrollTop use the scrollPos variable that i declare in the linking function.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants