From 52388dd4c1b9c3e3ebf32e6f0bbb173cdc106a68 Mon Sep 17 00:00:00 2001 From: DIYgod Date: Wed, 14 Mar 2018 23:11:22 +0800 Subject: [PATCH] changeable template.listCurs --- src/js/player.js | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/js/player.js b/src/js/player.js index cf905ed7..ee2a9153 100644 --- a/src/js/player.js +++ b/src/js/player.js @@ -466,11 +466,11 @@ class APlayer { this.container.classList.add('aplayer-withlist'); this.audio.loop = false; } - const songListLength = this.container.querySelectorAll('.aplayer-list li').length; - this.template.list.style.height = songListLength * 33 - 1 + 'px'; - this.template.listOl.style.height = songListLength * 33 - 1 + 'px'; + this.template.list.style.height = this.options.audio.length * 33 - 1 + 'px'; + this.template.listOl.style.height = this.options.audio.length * 33 - 1 + 'px'; this.randomOrder = utils.randomOrder(this.options.audio.length); + this.template.listCurs = this.container.querySelectorAll('.aplayer-list-cur'); } /** @@ -502,8 +502,10 @@ class APlayer { if (this.options.audio.length === 1) { this.container.classList.remove('aplayer-withlist'); } - this.template.list.style.height = parseInt(this.template.list.style.height, 10) - 33 + 'px'; - this.template.listOl.style.height = parseInt(this.template.listOl.style.height, 10) - 33 + 'px'; + this.template.list.style.height = this.options.audio.length * 33 - 1 + 'px'; + this.template.listOl.style.height = this.options.audio.length * 33 - 1 + 'px'; + + this.template.listCurs = this.container.querySelectorAll('.aplayer-list-cur'); } }