mirror of
https://github.com/MeiK2333/github-style.git
synced 2025-10-07 01:54:06 +00:00
Merge pull request #125 from yuweizzz/perf-user-profile
perf: adjust avatar position when in different box
This commit is contained in:
@@ -189,12 +189,19 @@
|
|||||||
<script>
|
<script>
|
||||||
window.onscroll = function (e) {
|
window.onscroll = function (e) {
|
||||||
const headerImg = document.querySelector('#headerImg');
|
const headerImg = document.querySelector('#headerImg');
|
||||||
|
const headerStuck = document.querySelector('#headerStuck');
|
||||||
if (headerImg.getBoundingClientRect().bottom <= 0) {
|
if (headerImg.getBoundingClientRect().bottom <= 0) {
|
||||||
document.querySelector('#headerStuck').classList.add('is-stuck');
|
headerStuck.classList.add('is-stuck');
|
||||||
|
if (window.innerWidth >= 1280) {
|
||||||
|
headerStuck.setAttribute('style', 'top: 12px;')
|
||||||
} else {
|
} else {
|
||||||
document.querySelector('#headerStuck').classList.remove('is-stuck');
|
headerStuck.setAttribute('style', 'top: 0;')
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
headerStuck.classList.remove('is-stuck');
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
var style = localStorage.getItem('data-color-mode');
|
var style = localStorage.getItem('data-color-mode');
|
||||||
iconElement = document.getElementById('github-icon');
|
iconElement = document.getElementById('github-icon');
|
||||||
if (style == 'light') {
|
if (style == 'light') {
|
||||||
|
Reference in New Issue
Block a user