Reputation: 3450
I have the following html:
<div class="row-20 st-margin" *ngIf="role == 'Administrator'" id="hr-data">
<div class="col-md-12"></div>
</div>
and after ajax call I have that div
visible.
Then I want to scroll to that div
by click:
document.getElementById('hr-data').scrollIntoView({behavior: 'smooth'});
but it doesn't work.
So, how can I fix that?
Upvotes: 0
Views: 129
Reputation: 3450
For some reasons, div class="row-20 st-margin"
has no height.
I moved id
to div class="col-md-12"
and it works fine:
<div class="row-20 st-margin" *ngIf="role == 'Administrator'">
<div class="col-md-12" id="hr-data"></div>
</div>
Upvotes: 1