Skip to content

Commit

Permalink
header nav
Browse files Browse the repository at this point in the history
  • Loading branch information
AxelCotonGutierrez committed Sep 26, 2024
1 parent d41ea2e commit 46a92e4
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion assets/js/header.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
document.addEventListener("DOMContentLoaded", function() {
// Código del encabezado
const headerHTML = `
<div class="menu">
<button class="menu-toggle">☰</button>
Expand All @@ -24,5 +25,15 @@ document.addEventListener("DOMContentLoaded", function() {
<img src="https://axelcotongutierrez.github.io/learningmathematicas/assets/images//top.jpg" alt="Blog Mathematica" style="display: block; margin: 0 auto; width: 100%; height: auto;">
</a>
`;
document.getElementById("header-placeholder").innerHTML = headerHTML;
const headerElement = document.createElement('header');
headerElement.innerHTML = headerHTML;
document.body.insertBefore(headerElement, document.body.firstChild);

// Navegación: Lógica para el menú
var menuToggle = document.querySelector('.menu-toggle');
var menu = document.querySelector('.menu');

menuToggle.addEventListener('click', function() {
menu.classList.toggle('active');
});
});

0 comments on commit 46a92e4

Please # to comment.