Skip to content

Commit

Permalink
fix(smart-select): fix scrollToSelectedItem in popover
Browse files Browse the repository at this point in the history
  • Loading branch information
nolimits4web committed Sep 13, 2021
1 parent 5005701 commit 84b552a
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/core/components/smart-select/smart-select-class.js
Original file line number Diff line number Diff line change
Expand Up @@ -628,11 +628,12 @@ class SmartSelect extends Framework7Class {
} else {
const $selectedItemEl = $containerEl.find('input:checked').parents('li');
if (!$selectedItemEl.length) return ss;
const $pageContentEl = $containerEl.find('.page-content');
$pageContentEl.scrollTop(
const $scrollableEl = $containerEl.find('.page-content, .popover-inner');
if (!$scrollableEl.length) return ss;
$scrollableEl.scrollTop(
$selectedItemEl.offset().top -
$pageContentEl.offset().top -
parseInt($pageContentEl.css('padding-top'), 10),
$scrollableEl.offset().top -
parseInt($scrollableEl.css('padding-top'), 10),
);
}
return ss;
Expand Down

0 comments on commit 84b552a

Please sign in to comment.