Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
这是我的代码:
$(body).scroll(function() { $('#page_text').scroll(); });
如您所见,我在滚动页面的其余部分时尝试滚动#page_text 非常糟糕。该网站具有非常特定的尺寸以适应屏幕的大小,因此#page_text 是溢出:自动...对于样式问题,我需要隐藏网站的滚动条。我希望我已经解释了自己,感谢所有想要帮助的人。
试试下面的代码:
$(document).ready(function() { $(document).on('scroll', function() { var docScrollHeight = $(this).scrollTop(); $('#page_text').scrollTop(docScrollHeight); }); });
这将在每个文档滚动时调用该函数,并找到当前文档的滚动高度。然后它将page_text元素滚动到相同的滚动高度。
page_text