$(document).ready(function() {
|
// 设置公共导航栏
|
// $("#header").load("./components/nav.html");
|
// 设置公共底部
|
// $("#footer").load("./components/footer.html");
|
|
// 当页面滚动到一定距离时显示返回顶部按钮
|
$('#back-to-top').fadeOut();
|
$(window).scroll(function() {
|
if ($(this).scrollTop() > 100) { // 这里可以根据需要调整数值
|
$('#back-to-top').fadeIn(); // 显示按钮
|
} else {
|
$('#back-to-top').fadeOut(); // 隐藏按钮
|
}
|
});
|
|
// 点击按钮时,页面平滑滚动到顶部
|
$('#back-to-top').click(function(event) {
|
event.preventDefault(); // 阻止链接的默认行为
|
$('html, body').animate({scrollTop: 0}, 800); // 页面平滑滚动到顶部,800毫秒完成滚动
|
});
|
|
$(".index-a-c-item").click(function () {
|
// console.log($(this).siblings())
|
$(this).siblings().each(function () {
|
let name = $(this).attr('name')
|
if (name === '资产管理') {
|
$(this).children().first().attr('src', './assets/icon/yunwei_ic_zichan@2x.png')
|
} else if (name === '巡检运维') {
|
$(this).children().first().attr('src', './assets/icon/yunwei_ic_xunjian@2x.png')
|
} else if (name === '仓储管理') {
|
$(this).children().first().attr('src', './assets/icon/yunwei_ic_cangchu@2x.png')
|
} else if (name === '商户管理') {
|
$(this).children().first().attr('src', './assets/icon/yunwei_ic_shanghu@2x.png')
|
}
|
$(this).css('background', '#ffffff')
|
$(this)
|
.children()
|
.last()
|
.children()
|
.css('color', '#191B1F')
|
})
|
if ($(this).attr('name') === '资产管理') {
|
$(this)
|
.css('background', '#FF7900')
|
.children()
|
.first()
|
.attr('src', './assets/icon/yunwei_ic_zichan_sel@2x.png')
|
} else if ($(this).attr('name') === '巡检运维') {
|
$(this)
|
.css('background', '#FF7900')
|
.children()
|
.first()
|
.attr('src', './assets/icon/yunwei_ic_xunjian_sel@2x.png')
|
} else if ($(this).attr('name') === '仓储管理') {
|
$(this)
|
.css('background', '#FF7900')
|
.children()
|
.first()
|
.attr('src', './assets/icon/yunwei_ic_cangchu_sel@2x.png')
|
} else if ($(this).attr('name') === '商户管理') {
|
$(this)
|
.css('background', '#FF7900')
|
.children()
|
.first()
|
.attr('src', './assets/icon/yunwei_ic_shanghu_sel@2x.png')
|
}
|
$(this)
|
.children()
|
.last()
|
.children()
|
.css('color', '#FFFFFF')
|
})
|
});
|