Skip to content

Commit

Permalink
fixed breakpoints again
Browse files Browse the repository at this point in the history
  • Loading branch information
dominrios committed Oct 3, 2024
1 parent 00a2004 commit e52840b
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 7 deletions.
10 changes: 8 additions & 2 deletions assets/js/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
const currentWidth = window.innerWidth;
console.log(`Current window width: ${currentWidth}`); // Log the current width for debugging
const calibrationList = Object.keys(calibrationMap).map(Number).sort((a, b) => a - b);
const lastBreakpoint = calibrationList[calibrationList.length - 1]; // Get the largest breakpoint

let appliedBreakpoint = null;

Expand All @@ -49,13 +50,18 @@
}
}

// checking applied breakpoint
// console.log("checking applied breakpoint", appliedBreakpoint);
// If no suitable breakpoint was found, use the largest breakpoint
if (appliedBreakpoint === null) {
appliedBreakpoint = lastBreakpoint;
}

console.log("checking applied breakpoint", appliedBreakpoint);
if (appliedBreakpoint !== null) {
onBreakpointHit(appliedBreakpoint, calibrationMap[appliedBreakpoint]);
}
}


// Debounce the checkWindowWidth function
const debouncedCheckWindowWidth = debounce(checkWindowWidth, 200);

Expand Down
18 changes: 14 additions & 4 deletions assets/sass/custom.scss
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,12 @@ img {vertical-align: middle;}


$breakpoints: (
laptopls: 2685px,
laptopl: 2560px,
default: 1920px,
wide: 1680px,
laptop: 1520px,
laptopm: 1440px,
laptopm: 1520px,
laptops: 1440px,
normal: 1280px,
tablet: 1024px,
narrow: 980px,
Expand All @@ -51,6 +53,14 @@ $breakpoints: (
/* Adjusting margin for CTA below the slideshow banner */
margin-bottom: 32.9%;

@include breakpoint(laptopls){
margin-bottom: 34%
}

@include breakpoint(laptopl){
margin-bottom: 32.9%
}

@include breakpoint(default){
margin-bottom: 24.8%;
}
Expand All @@ -59,11 +69,11 @@ $breakpoints: (
margin-bottom: 24.8%;
}

@include breakpoint(laptop) {
@include breakpoint(laptopm) {
margin-bottom: 26.8%
}

@include breakpoint(laptopm) {
@include breakpoint(laptops) {
margin-bottom: 25.1%
}

Expand Down

Large diffs are not rendered by default.

0 comments on commit e52840b

Please sign in to comment.