JavaScript preprocessors can help make authoring JavaScript easier and more convenient. For instance, CoffeeScript can help prevent easy-to-make mistakes and offer a cleaner syntax and Babel can bring ECMAScript 6 features to browsers that only support ECMAScript 5.
Any URL's added here will be added as <script>
s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.
You can apply a script from anywhere on the web to your Pen. Just put a URL to it here and we'll add it, in the order you have them, before the JavaScript in the Pen itself.
If the script you link to has the file extension of a preprocessor, we'll attempt to process it before applying.
You can also link to another Pen here, and we'll pull the JavaScript from that Pen and include it. If it's using a matching preprocessor, we'll combine the code before preprocessing, so you can use the linked Pen as a true dependency.
HTML Settings
Here you can Sed posuere consectetur est at lobortis. Donec ullamcorper nulla non metus auctor fringilla. Maecenas sed diam eget risus varius blandit sit amet non magna. Donec id elit non mi porta gravida at eget metus. Praesent commodo cursus magna, vel scelerisque nisl consectetur et.
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<script defer src="https://use.fontawesome.com/releases/v5.0.8/js/all.js" integrity="sha384-SlE991lGASHoBfWbelyBPLsUlwY1GwNDJo3jSJO04KZ33K2bwfV9YBauFfnzvynJ" crossorigin="anonymous"></script>
<title>Martín Comito - Home</title>
</head>
<body>
<!-- NAVBAR -->
<nav class="navbar navbar-expand-lg sticky-top navbar-dark bg-dark">
<a class="navbar-brand" href="#">Martín Comito</a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarSupportedContent">
<ul class="navbar-nav mr-auto">
<li class="nav-item active">
<a class="nav-link" href="#">Home <span class="sr-only">(current)</span></a>
</li>
<li class="nav-item">
<a class="nav-link" href="#aboutme">About me</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#portfolio">Portfolio</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#contact">Contact me</a>
</li>
</ul>
</div>
</nav>
<!-- NAVBAR -->
<header>
</header>
<section>
<div class="container-fluid seccion" id="aboutme">
<div class="row">
<div class="col-md aboutme-div text-center my-5 px-5">
A ver
</div>
</div>
</section>
<section>
<div class="container-fluid seccion" id="portfolio">
Portfolio
</div>
</section>
<section>
<div class="container-fluid seccion" id="contact">
Contact me
</div>
</section>
<footer>
<p>Copyright 2018 Martín Comito</p>
</footer>
</body>
</html>
body {
background-color: green;
}
.seccion {
background-color: grey;
height: 500px;
border: 1px solid black;
margin-bottom: 10px;
margin-top: 10px;
}
footer {
text-align: center;
}
.aboutme-div {
background-color: yellow;
}
$(document).ready(() => {
// set up scrollspy - only needed on codepen because they add the <body> tag for you
$("body").attr({
"data-spy": "scroll",
"data-target": ".navbar",
"data-offset": "80"
});
//Ajusta la posición del scroll cuando estás navegando para guardar links desde otra página
const scrollAdjust = () => scrollBy(0, -60);
if (location.hash) scrollAdjust();
window.addEventListener("hashchange", scrollAdjust);
// Scroll suave
$("a.navbar-brand, .navbar-nav li a:not(.dropdown-toggle)").on("click", e => {
$(".collapse").collapse("hide"); // close mobile menu on click
$("html, body")
.stop()
.animate(
{
scrollTop: $($(e.currentTarget).attr("href")).offset().top - 60
},
1250,
"easeInOutExpo"
);
});
});
Also see: Tab Triggers