// 头部导航点击事件
$(".tab-head li").click(function() {
var moveX = $(this).position().left + $(this).parent().scrollLeft();
var pageX = document.documentElement.clientWidth; //设备的宽度
var blockWidth = $(this).width();
var left = moveX - (pageX / 2) + (blockWidth / 2);
$(".tab-head").animate({ scrollLeft: left }, 400);
$(this).addClass("active").siblings().removeClass("active");
});
头部导航navbar点击自动滚动
最新推荐文章于 2024-02-01 11:11:53 发布