mirror of
https://github.com/flarum/framework.git
synced 2024-11-26 10:14:16 +08:00
Fix index pane autoscroll
This commit is contained in:
parent
7863f0114c
commit
64270fd066
|
@ -55,19 +55,21 @@ export default Ember.View.extend({
|
|||
},
|
||||
|
||||
scrollToDiscussion: function() {
|
||||
var view = this;
|
||||
Ember.run.scheduleOnce('afterRender', function() {
|
||||
var $index = view.$('.index-area');
|
||||
var $discussion = $index.find('.discussion-summary.active');
|
||||
if ($discussion.length) {
|
||||
var indexTop = $index.offset().top;
|
||||
var discussionTop = $discussion.offset().top;
|
||||
if (discussionTop < indexTop || discussionTop + $discussion.outerHeight() > indexTop + $index.outerHeight()) {
|
||||
$index.scrollTop($index.scrollTop() - indexTop + discussionTop);
|
||||
if (this.get('controller.paned')) {
|
||||
var view = this;
|
||||
Ember.run.scheduleOnce('afterRender', function() {
|
||||
var $index = view.$('.index-area');
|
||||
var $discussion = $index.find('.discussion-summary.active');
|
||||
if ($discussion.length) {
|
||||
var indexTop = $index.offset().top;
|
||||
var discussionTop = $discussion.offset().top;
|
||||
if (discussionTop < indexTop || discussionTop + $discussion.outerHeight() > indexTop + $index.outerHeight()) {
|
||||
$index.scrollTop($index.scrollTop() - indexTop + discussionTop);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}.observes('controller.controllers.discussion.model'),
|
||||
});
|
||||
}
|
||||
}.observes('controller.paned'),
|
||||
|
||||
populateSidebarDefault: function(sidebar) {
|
||||
var view = this;
|
||||
|
|
Loading…
Reference in New Issue
Block a user