Javascript 为什么平滑滚动在我的持久标题上不起作用;s处于初始状态且不固定?
这是我正在开发的网站 当收割台固定到该位置时,平滑滚动开始工作 persist.js:Javascript 为什么平滑滚动在我的持久标题上不起作用;s处于初始状态且不固定?,javascript,html,persistent,Javascript,Html,Persistent,这是我正在开发的网站 当收割台固定到该位置时,平滑滚动开始工作 persist.js: function UpdateTableHeaders() { $(".persist-area").each(function() { var el = $(this), offset = el.offset(), scrollTop = $(window).scrollTop(), floatingHea
function UpdateTableHeaders() {
$(".persist-area").each(function() {
var el = $(this),
offset = el.offset(),
scrollTop = $(window).scrollTop(),
floatingHeader = $(".floatingHeader", this)
if ((scrollTop > offset.top) && (scrollTop < offset.top + el.height())) {
floatingHeader.css({
"visibility": "visible"
});
} else {
floatingHeader.css({
"visibility": "hidden"
});
};
});
}
// DOM Ready
$(function() {
var clonedHeaderRow;
$(".persist-area").each(function() {
clonedHeaderRow = $(".persist-header", this);
clonedHeaderRow
.before(clonedHeaderRow.clone())
.css("width", clonedHeaderRow.width())
.addClass("floatingHeader");
});
$(window)
.scroll(UpdateTableHeaders)
.trigger("scroll");
});
$(document).ready(function() {
$('ul.mainNavScroll a').smoothScroll();
$('p.subnav a').click(function(event) {
event.preventDefault();
var link = this;
$.smoothScroll({
scrollTarget: link.hash
});
});
$('button.scrollsomething').click(function() {
$.smoothScroll({
scrollElement: $('div.scrollme'),
scrollTarget: '#findme'
});
return false;
});
$('button.scrollhorz').click(function() {
$.smoothScroll({
direction: 'left',
scrollElement: $('div.scrollme'),
scrollTarget: '.horiz'
});
return false;
});
});
提前谢谢你