mirror of
https://github.com/owntone/owntone-server.git
synced 2025-11-07 04:42:58 -05:00
[web] Ensure current lyric is centered
This commit is contained in:
@@ -165,12 +165,15 @@ export default {
|
||||
return
|
||||
}
|
||||
|
||||
let currentLyric = scrollTouch.children[0].children[this.lyricIndex],
|
||||
let currentLyric = scrollTouch.children[0].children[this.lyricIndex + 1], // Because of space item
|
||||
offsetToCenter = scrollTouch.offsetHeight >> 1
|
||||
if (!this.lyricsArr || !currentLyric) return
|
||||
|
||||
let currOff = scrollTouch.scrollTop,
|
||||
destOff = currentLyric.offsetTop - offsetToCenter
|
||||
destOff =
|
||||
currentLyric.offsetTop -
|
||||
offsetToCenter +
|
||||
(currentLyric.offsetHeight >> 1)
|
||||
// Using scrollBy ensure that scrolling will happen
|
||||
// even if the element is visible before scrolling
|
||||
scrollTouch.scrollBy({
|
||||
|
||||
@@ -55,8 +55,6 @@ export default {
|
||||
margin-bottom: 10px;
|
||||
margin-left: 24px;
|
||||
margin-right: 24px;
|
||||
box-shadow:
|
||||
0 4px 8px 0 rgba(0, 0, 0, 0.2),
|
||||
0 6px 20px 0 rgba(0, 0, 0, 0.19);
|
||||
box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.19);
|
||||
}
|
||||
</style>
|
||||
|
||||
Reference in New Issue
Block a user