DIYgod / DIYgod/APlayer

Automatically reload whenever I jump to another page inside the blog

Open
#264 4 comments 1 reaction 0 assignees View on GitHub
Dominant language
JavaScript
Stars
7.7k
Forks
1.1k
PR merge metrics
No merged PRs in 30d

Description

I am now using Hexo `v3.8.0` with theme Next `v7.0.0` in Windows10.

This is the way how I introduce aplayer to my blog:

1. copy and paste the dist folder to `blog\theme\next\source`
2. create file `music.js` in `blog\theme\next\source` and the code goes like this:
```js
const ap = new APlayer({
container: document.getElementById('aplayer'),
fixed: true,
autoplay: false,
theme: '#a3f9e8',
lrcType: 3,
audio: [
{
name: '',
artist: '',
url: '',
cover: '',
lrc: '',
},
]
});
```

3. add the code below to `blog\theme\next\layout\_layout.swig` after line ``

```css

```

It actually works, but whenever I move to some other pages in my blog (for example from home page to one of my post), the player will always reload (even though I am using fixed mode), which means I have to click the 'play' button to play the music again from the beginning. I think it is annoying, so I am here to ask whether there is some method to prevent this event from happening.

You can visit my [blog](https://swayye.xyz) to have to look.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.