hbt-moore-stone-ui/js/basic.js

47 lines
1.2 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

/**
* Created by Administrator on 2017/1/16.
*/
$(function () {
//加载公用部分,写程序的时候记得删除!!
$("header").load("header.html");
$("footer").load("footer.html");
//$(".sidebar").load("sidebar.html");
if (window.innerWidth >= 640) {
$(".cloud-product-ul li").hover(function () {
$(this).addClass("active").siblings().removeClass("active");
})
$(".solution-list ul li").hover(function () {
$(this).addClass("active").siblings().removeClass("active");
})
} else {
$('.cloud-product-ul li').filter(':even').removeClass("active").addClass('active');
$('.i_solution p').text('...');
$('.nproduct_list2 .f24').next().text('...')
}
// 监听页面滚动当滚动超过首屏高度时给header添加active类
let windowHeight = $(window).height(); // 获取窗口高度作为首屏高度判断标准
$(window).scroll(function() {
let scrollTop = $(window).scrollTop();
if (scrollTop > windowHeight) {
$('.home-header .header-v1').addClass('active');
} else {
$('.home-header .header-v1').removeClass('active');
}
});
});