gpt4 book ai didi

javascript - 我如何使用 ScrollSpy?

转载 作者:行者123 更新时间:2023-11-28 03:30:30 28 4
gpt4 key购买 nike

我一直在努力建立我的网站,我真的很想在我的页面上有一些字体很棒的字形,当我滚动时它们会淡入。问题是我不太了解 Spyscroll 或如何使用它。

这是我的代码,也许任何人都可以帮助我。

#section2{
position: absolute;
top: 105%;
}
html {

}
p{
color: white;
}
.servicetitle{
color: white;
}
.btn-light{
color:white;
}
#onzespecialiteiten {
text-align: center;
margin-top: -5%;
}
<!DOCTYPE html>
<html lang="en" style="height: 200%">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="styles.css">

<title>Exodius Webdesign</title>

<!-- Bootstrap -->
<link href="css/bootstrap.min.css" rel="stylesheet">
<link href="https://fonts.googleapis.com/css?family=Titillium+Web" rel="stylesheet">
<link href="https://fonts.googleapis.com/css?family=Dosis" rel="stylesheet">
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script>
<script src="js.js"></script>
<script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<link rel="stylesheet" href="https://www.w3schools.com/w3css/4/w3.css">
<link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet" integrity="sha384-wvfXpqpZZVQGK6TAh5PVlGOfQNHSoD2xbE+QkPxCAFlNEevoEH3Sl0sibVcOQVnN" crossorigin="anonymous">
<script>
$(document).ready(function(){
// Add smooth scrolling to all links
$("a").on('click', function(event) {

// Make sure this.hash has a value before overriding default behavior
if (this.hash !== "") {
// Prevent default anchor click behavior
event.preventDefault();

// Store hash
var hash = this.hash;

// Using jQuery's animate() method to add smooth page scroll
// The optional number (800) specifies the number of milliseconds it takes to scroll to the specified area
$('html, body').animate({
scrollTop: $(hash).offset().top
}, 800, function(){

// Add hash (#) to URL when done scrolling (default click behavior)
window.location.hash = hash;
});
} // End if
});
});
</script>

<nav class="navbar navbar-default navbar-fixed-top" style="background-color: transparent; border: none;" >
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#myNavbar">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a style="color: #ffffff" class="navbar-brand" href="#myPage">Exodius Webdesign</a>
</div>
<div class="collapse navbar-collapse" id="myNavbar">
<ul class="nav navbar-nav navbar-right">
<li class=""><a style="color: #ffffff" href="#about">ABOUT</a></li>
<li class=""><a style="color: #ffffff" href="#services">SERVICES</a></li>
<li class=""><a style="color: #ffffff" href="#portfolio">PORTFOLIO</a></li>
<li class=""><a style="color: #ffffff" href="#pricing">PRICING</a></li>
<li class=""><a style="color: #ffffff" href="#contact">CONTACT</a></li>
</ul>
</div>
</div>
</nav>
</head>
<body id="myPage" data-spy="scroll" data-target="col-md-3 col-sm-6" data-offset="60" style="background-color: #293B4D; height: 200%">

<!-- Content van home -->
<h1 style="margin-top: 15%; margin-left: 55%; color: white; font-family: 'Titillium Web', sans-serif;" >Exodius Webdesign</h1>
<p style="margin-top: 1%; margin-left: 30%; text-align: center; color: white; font-family: 'Dosis', sans-serif;">Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor. Aenean massa.</p>
<img src="images/logotransparant.png" alt="logo" height="560" width="960" style="margin-left: -5%; margin-top: -12%">

<!-- Dit is de button en de section waarnaar die naartoe scrollt -->
<a href="#section2" class="btn" id="butonn" type="button" style="background-color: #ffffff; color:black; margin-left: -2%; margin-bottom: 17%; border-radius: 14px; width: 250px">Lees meer</a>

<div id="section2">
<section></section>
</div>

<!-- Dit is het blauwe vlak -->
<div class="jumbotron" style="margin-top: 5%; height: 790px; background-color: #3692D0">
<div style="margin: 10%; text-align: center" class="row">
<p id="onzespecialiteiten">Onze Specialiteiten</p>
<hr width="25%" style="margin-left: 38%; margin-top: 2%"><br><br><br><br>
<div class="col-md-3 col-sm-6" >

<div class="w3-container w3-center w3-animate-zoom" >
<span class="fa-stack fa-4x">
<i class="fa fa-circle fa-stack-2x"></i>
<i class="fa fa-cloud fa-stack-1x text-primary"></i>
</span>
<h4 class="servicetitle">
<strong>Webdesign</strong>
</h4>
<p>Wij bouwen binnen één week een website met Wordpress of Bootstrap</p>
<a href="#" class="btn btn-light">Lees Meer</a>

</div>
</div>
<div class="col-md-3 col-sm-6" >
<div class="w3-container w3-center w3-animate-zoom" style="animation-delay: 0.1s;">
<span class="fa-stack fa-4x">
<i class="fa fa-circle fa-stack-2x"></i>
<i class="fa fa-compass fa-stack-1x text-primary"></i>
</span>
<h4 class="servicetitle">
<strong>Photoshop</strong>
</h4>
<p>Wij kunnen vrijwel met alle Photoshop opdrachten overweg</p>
<a href="#" class="btn btn-light">Lees Meer</a>
</div>
</div>


<div class="col-md-3 col-sm-6">
<div class="w3-container w3-center w3-animate-zoom" style="animation-delay: 0.12s;">
<span class="fa-stack fa-4x">
<i class="fa fa-circle fa-stack-2x"></i>
<i class="fa fa-flask fa-stack-1x text-primary"></i>
</span>
<h4 class="servicetitle">
<strong>Webshops</strong>
</h4>
<p>Wij kunnen met Wordpress CMS complete Webshops bouwen</p>
<a href="#" class="btn btn-light">Lees Meer</a>
</div>
</div>
<div class="col-md-3 col-sm-6">
<div class="w3-container w3-center w3-animate-zoom" style="animation-delay: 0.13s;">
<span class="fa-stack fa-4x">
<i class="fa fa-circle fa-stack-2x"></i>
<i class="fa fa-shield fa-stack-1x text-primary"></i>
</span>
<h4 class="servicetitle">
<strong>Service Name</strong>
</h4>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit.</p>
<a href="#" class="btn btn-light">Learn More</a>
</div>
</div>
</div>
</div>

<!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
<!-- Include all compiled plugins (below), or include individual files as needed -->
<script src="js/bootstrap.min.js"></script>
<script>
$("#buttonn").click(function() {
$('.transform').toggleClass('transform-active');
});


</script>
</body>
</html>

最佳答案

检查这个链接和下一个视频,您就会明白这一点

https://www.youtube.com/watch?v=K2qjgCRkmt8&index=47&list=PL6n9fhu94yhXd4xnk-j5FGhHjUv1LsF0V

关于javascript - 我如何使用 ScrollSpy?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44760055/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com