Labo29
Labo29

Reputation: 117

page-scrolling with angularjs and IFrame

I created an angular controller, and in the:

angular.element(document).ready(function () { ... }

I placed my function for a smooth scrolling to the hash of the window.location.hash (using .animate({scrollTop... ). The problem is that in the page there is an IFrame, and after it has finished loading its content, the page scrolls again to the starting position. Where is the problem? why after everything has finished to load the page scrolls to its starting position? Can I avoid this behavior?

Upvotes: 0

Views: 581

Answers (1)

Labo29
Labo29

Reputation: 117

In the end, I placed my function in:

angular.element(window).load(function () {...}

In this way I can launch my function after that all the iframes are loaded.

Upvotes: 1

Related Questions