29 lines
627 B
JavaScript
29 lines
627 B
JavaScript
|
|
// 右上角菜单按钮
|
||
|
|
$('.navbar-toggler').on('click', function() {
|
||
|
|
const expanded = $(this).attr('aria-expanded')
|
||
|
|
if(expanded == 'false') {
|
||
|
|
$(this).addClass('close-nav')
|
||
|
|
}
|
||
|
|
else {
|
||
|
|
$(this).removeClass('close-nav')
|
||
|
|
}
|
||
|
|
})
|
||
|
|
|
||
|
|
/**
|
||
|
|
* home.html
|
||
|
|
*/
|
||
|
|
function updatePcImg() {
|
||
|
|
const vw = document.body.clientWidth
|
||
|
|
$('.pc-source').each(function() {
|
||
|
|
const styl = this.getAttribute('style')
|
||
|
|
if(vw > 767.98) {
|
||
|
|
const url = this.getAttribute('data-pc-url')
|
||
|
|
this.setAttribute('style', `background-image: url(${url})`)
|
||
|
|
}
|
||
|
|
else {
|
||
|
|
this.setAttribute('style', styl)
|
||
|
|
}
|
||
|
|
})
|
||
|
|
}
|
||
|
|
updatePcImg()
|
||
|
|
window.onresize = updatePcImg
|