APlayer
APlayer copied to clipboard
listMaxHeight does not work and no scroll in Fixed mode
The listMaxHeight does not work and no scroll in Fixed mode. This problem also like : https://github.com/MoePlayer/APlayer/issues/277#issue-456161855
config:
<script>
const ap = new APlayer({
container: document.getElementById('aplayer'),
fixed: true,
autoplay: false,
theme: '#b7daff',
loop: 'all',
order: 'list',
preload: 'auto',
volume: 0.5,
lrcType: 3,
mutex: true,
listFolded: false,
listMaxHeight: 30,
pic:
I don't know if it doesn't work in this mode, or if my other styles affect it.
I use Aplayer in my blog using hexo-yilia,if I not update the blog,you can see the problem in my site https://www.yansheng.xyz/
Found
I already know what the problem is:When i config like the example:·listMaxHeight: 90,
The generated code looks like this:
<div class="aplayer-list" style="max-height: 90">
<ol style="max-height: 90">
But when i see someone which it will work, is like this:
<div class="aplayer-list" style="max-height: 250px">
<ol style="max-height: 250px">
It problem is px
.
Trying
When I try to use this config : listMaxHeight: 90px,
.The browser will report an error:
When I search the keyword listMaxHeight
in CDN file
The keyword appears in three clusters and two similar ones.
-
(3)Concatenate strings to html,but don't contain
px
: -
As you can see, there is a default value
250px
Please focus on the px
:
Conclusion
Draw a conclusion,this a :bug:.
First of all, thanks to yansheng836 for the discovery.
In the official documentation, this is indeed a bug.
Just change that number to a string form of number + px when configuring. Like this:
listMaxHeight: '500px'
Use this to make it work for now until the bug is officially fixed.
It really does work.
Note that the number in the configuration is not the number of rows in the list, but the px value.
Note that the number in the configuration is not the number of rows in the list, but the px value.
Thank you very much for your answer 🌹