我尝试建立一个个人网站,使用jQuery-scrollify工具来滚动浏览我的网站的几个部分。但是,无论我使用什么设置,我都不能让页面始终正确滚动。如果屏幕太小或太大,那么最后一个部分将不会滚动显示溢出的内容。但是在中间的某个地方,内容确实可以正确滚动。我已经切换了setHeight属性,它似乎解决了一些溢出滚动的问题,但会导致某些部分在不同的高度重叠。
我已经为此工作了两天的大部分时间,尝试交替不同的设置和更改页面布局,以适应工具,但没有取得任何进展。page的内容是:
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>**</title>
<link rel="apple-touch-icon" sizes="57x57" href="img/icons/apple-icon-57x57.png">
<link rel="apple-touch-icon" sizes="60x60" href="img/icons/apple-icon-60x60.png">
<link rel="apple-touch-icon" sizes="72x72" href="img/icons/apple-icon-72x72.png">
<link rel="apple-touch-icon" sizes="76x76" href="img/icons/apple-icon-76x76.png">
<link rel="apple-touch-icon" sizes="114x114" href="img/icons/apple-icon-114x114.png">
<link rel="apple-touch-icon" sizes="120x120" href="img/icons/apple-icon-120x120.png">
<link rel="apple-touch-icon" sizes="144x144" href="img/icons/apple-icon-144x144.png">
<link rel="apple-touch-icon" sizes="152x152" href="img/icons/apple-icon-152x152.png">
<link rel="apple-touch-icon" sizes="180x180" href="img/icons/apple-icon-180x180.png">
<link rel="icon" type="image/png" sizes="192x192" href="img/icons/android-icon-192x192.png">
<link rel="icon" type="image/png" sizes="32x32" href="img/icons/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="96x96" href="img/icons/favicon-96x96.png">
<link rel="icon" type="image/png" sizes="16x16" href="img/icons/favicon-16x16.png">
<link rel="manifest" href="img/icons/manifest.json">
<meta name="msapplication-TileColor" content="#ffffff">
<meta name="msapplication-TileImage" content="img/icons/ms-icon-144x144.png">
<meta name="theme-color" content="#ffffff">
<!-- Fonts -->
<link href="https://fonts.googleapis.com/css?family=Playfair+Display" rel="stylesheet">
<script type="text/javascript" src="js/app.js?v=234651"></script>
<script type="text/javascript" src="js/jquery.scrollify.min.js"></script>
<link rel="stylesheet" href="css/app.css?v=234651">
</head>
<body>
<div class="page-header">
<div>
<h1>**</h1>
</div>
<div>
<h2>Full Stack Software Developer</h2>
</div>
</div>
<div class="sidebar">
<div class="about">
<h3>About Me</h3>
<ul>
<li><a href="#bio" data-name="2">Bio</a></li>
<li><a href="#education" data-name="3">Education</a></li>
<li><a href="#experience" data-name="4">Experience</a></li>
</ul>
</div>
<div class="contact">
<h3>Find Me</h3>
<ul>
<li><a href="https://www.linkedin.com/in/**/" target="_blank">LinkedIn</a></li>
<li><a href="https://github.com/**" target="_blank">Github</a></li>
<li><a href="mailto:**@gmail.com">Contact</a></li>
</ul>
</div>
</div>
<div class="main-content">
<div class="page" id="banner">
<img src="img/fun_me_cropped.jpg" class="banner-img">
</div>
<div class="page" id="bio">
</div>
<div class="page" id="education">
</div>
<div class="page" id="experience">
</div>
</div>
<script>
$(document).ready(function() {
//different scrollify options based on screen size
const scroll_opts = [
{
section: '.page',
offset: -150,
// scrollbars: false,
setHeights: false
},
{
section: '.page',
offset: 0,
scrollbars: false,
setHeights: false
}
];
//initialize scrollify based on document width
if (document.body.clientWidth > 600) {
$.scrollify(scroll_opts[0]);
} else {
$.scrollify(scroll_opts[1]);
}
//override default linking to use scrollify move method
$('.about a').click(function (e) {
e.preventDefault();
$.scrollify.move('#' + $(this).attr('data-name'));
});
//prevent excessive processing on resize $(window).resize(function() {
$(window).resize(function () {
if (this.resizeTO) clearTimeout(this.resizeTO);
this.resizeTO = setTimeout(function () {
$(this).trigger('resizeEnd');
}, 500);
});
$(window).bind('resizeEnd', function () {
if (document.body.clientWidth > 600) {
$.scrollify.setOptions(scroll_opts[0]);
} else {
$.scrollify.setOptions(scroll_opts[1]);
}
});
});
</script>
</body>
</html>
编辑-这显然是一个流行的职位,我意识到这是一些个人信息在它,这可能是不太适合这样的职位。所以我清理了HTML。
1条答案
按热度按时间0yg35tkg1#
听起来像是您的分区中有折叠的内容。当内容在未清除的容器中浮动时会发生这种情况。