Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
114 changes: 94 additions & 20 deletions css/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,10 @@ body {
top: 0;
left: 0;
right: 0;
z-index: 1030; /* Highest z-index */
z-index: 1030;
background: var(--bs-dark) !important;
transition: all 0.3s ease;
width: 100%;
min-height: 70px;
padding: 1rem 0;
}
Expand Down Expand Up @@ -156,14 +158,13 @@ body {
min-height: 95vh; /* This makes it take full viewport height */
background: var(--bs-dark);
color: var(--bs-light);
padding: 0; /* Remove default padding */
padding: 0;
margin-bottom: 3rem;
min-width: 100%;
}

/* If the image is too large, you might want to constrain its height */
.hero-section .about-img img {
max-height: 40vh; /* Adjust this value as needed */
max-height: 40vh;
width: auto;
}

Expand All @@ -172,6 +173,9 @@ body {
position: sticky;
top: 70px;
background: var(--bs-dark);
padding: 2rem 0;
margin-bottom: 0;
z-index: 1020;
padding: 2rem;
margin: 0;
z-index: 1020;
Expand Down Expand Up @@ -202,6 +206,12 @@ body {
z-index: -1;
}

/*** Sections ***/
section {
position: relative;
min-height: auto;
}

.section-header.is-sticky {
box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}
Expand All @@ -210,7 +220,6 @@ body {
section {
position: relative;
margin: 0;
margin-bottom: 0;
}

.section-content {
Expand Down Expand Up @@ -454,13 +463,14 @@ section {

.testimonial-carousel .owl-dots {
width: 100%;
height: 80px; /* Fixed height that accommodates both normal and active states */
height: auto;
display: flex;
align-items: center;
justify-content: center;
margin-top: 2rem;
padding: 0;
padding: 1rem;
position: relative; /* Add this */
flex-wrap: wrap;
}

.testimonial-carousel .owl-dots .owl-dot {
Expand Down Expand Up @@ -711,6 +721,16 @@ section {

/*** Media Queries ***/
@media (max-width: 991px) {

body {
padding-top: 56px; /* Standard mobile navbar height */
}

.navbar {
min-height: 56px;
padding: 0.5rem 0;
}

.navbar-collapse {
background: var(--bs-dark);
padding: 1rem;
Expand All @@ -733,6 +753,25 @@ section {
position: relative;
}

.section-header {
top: 56px;
padding: 0.75rem;
margin-bottom: 0;
}

.section-content {
padding: 1rem 0;
}

.text-body {
padding: 1rem;
margin: 0;
}

section {
margin-bottom: 0;
}

.section-header h2 {
font-size: 1.75rem;
}
Expand All @@ -755,6 +794,38 @@ section {
}

@media (max-width: 767px) {

body {
padding-top: 56px; /* Standard mobile navbar height */
}

.navbar {
min-height: 56px;
padding: 0.5rem 0;
}

.navbar-collapse {
background: var(--bs-dark);
padding: 1rem;
margin-top: 0.5rem;
max-height: calc(100vh - 70px);
overflow-y: auto;
}

.navbar .container-fluid .container {
padding: 0 15px;
}

.navbar-brand {
z-index: 1000;
position: relative;
}

.navbar-toggler {
z-index: 1000;
position: relative;
}

.hero-section {
padding: 4rem 0;
}
Expand All @@ -764,25 +835,28 @@ section {
}

.section-header {
padding: 0.75rem 0;
top: 56px;
padding: 0.75rem;
margin-bottom: 0;
}

.section-header h2 {
font-size: 1.25rem;
margin: 0;
}


.section-content {
padding: 0.75rem 0;
padding: 1rem 0;
}

/* Remove any unexpected margins */
.container, .container-fluid {
padding-left: 15px;
padding-right: 15px;

.text-body {
padding: 1rem;
margin: 0;
}

section {
margin-bottom: 0;
}

.section-header h2 {
font-size: 1.5rem;
}

.testimonial-carousel .owl-nav {
display: none;
}
Expand Down
70 changes: 44 additions & 26 deletions js/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@
return false;
});

// Sticky Navbar

// Simple navbar scroll spy
document.addEventListener("DOMContentLoaded", function () {
const dataSpyList = document.querySelectorAll('[data-bs-spy="scroll"]');
dataSpyList.forEach((dataSpyEl) => {
Expand All @@ -51,44 +52,61 @@
if (this.hash !== "") {
e.preventDefault();
const hash = this.hash;

document.querySelectorAll(".navbar-nav a.nav-link").forEach((l) => {
l.classList.remove("active");
});
this.classList.add("active");

document.querySelector(hash).scrollIntoView({
behavior: "smooth",
});

// En móvil cerrar tras pulsar un enlace

const navbarToggle = document.querySelector(".navbar-toggler");
if (window.getComputedStyle(navbarToggle).display !== "none") {
document.querySelector(".navbar-collapse").classList.remove("show");
}

}
});
});
});

document.addEventListener("DOMContentLoaded", function () {
const navbar = document.querySelector(".navbar");
const navbarHeight = navbar.offsetHeight;

const observer = new IntersectionObserver(
(entries) => {
entries.forEach((entry) => {
const header = entry.target.querySelector(".section-header");
const nextSection = entry.target.nextElementSibling;

if (!header) return;

window.addEventListener("scroll", () => {
const scrollPosition = window.scrollY;

document.querySelectorAll("section").forEach((section) => {
const sectionTop = section.offsetTop - 150; // 150px de margen
const sectionBottom = sectionTop + section.offsetHeight;

if (scrollPosition >= sectionTop && scrollPosition < sectionBottom) {
const currentId = section.getAttribute("id");
document
.querySelectorAll(".navbar-nav a.nav-link")
.forEach((link) => {
link.classList.remove("active");
if (link.getAttribute("href") === `#${currentId}`) {
link.classList.add("active");
if (entry.isIntersecting) {
header.style.position = "sticky";
header.style.top = `${navbarHeight}px`;

// Only handle the case where headers would overlap
if (nextSection) {
const sectionRect = entry.target.getBoundingClientRect();
const headerRect = header.getBoundingClientRect();

if (sectionRect.bottom <= headerRect.height + navbarHeight) {
header.style.position = "absolute";
header.style.top = `${entry.target.offsetHeight - headerRect.height}px`;
}
});
}
});
}
}
});
},
{
threshold: [0],
rootMargin: `-${navbarHeight}px 0px 0px 0px`
}
);

// Observe each section
document.querySelectorAll("section").forEach((section) => {
observer.observe(section);

});
});
})(jQuery);
})(jQuery);