Skip to content

Commit

Permalink
Remove buggy --width functionality
Browse files Browse the repository at this point in the history
  • Loading branch information
LeaVerou committed Feb 18, 2024
1 parent 64695a5 commit 905d2d9
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 20 deletions.
6 changes: 0 additions & 6 deletions inspire.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -414,12 +414,6 @@ let _ = {
// Adjust font size to prevent scrolling
_.adjustFontSize();

// Set slide width as a CSS variable, if smaller than viewport
if (slide.offsetWidth < innerWidth) {
slideWidthUpdated(slide);
// slideResizeObserver.observe(slide);
}

// Show or hide onscreen navigation
$("#onscreen-nav").classList.toggle("hidden", !slide.matches(".onscreen-nav"));

Expand Down
11 changes: 0 additions & 11 deletions src/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,17 +68,6 @@ export function deduplicateId (element) {
}
}

export function slideWidthUpdated (slide) {
let delta = 30;
if (slide.offsetWidth + delta < innerWidth) {
let width = parseFloat(getComputedStyle(slide).width);
slide.style.setProperty("--width", Math.ceil(width) + delta);
}
else {
slide.style.removeProperty("--width");
}
}

export function bind (element, events) {
for (let names in events) {
for (let name of names.split(/\s+/)) {
Expand Down
4 changes: 1 addition & 3 deletions style/base.css
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,6 @@ img {

.slide {
--slide-padding: 2.5rem;
--width-px: calc(var(--width) * 1px);

display: flex;
flex-flow: column;
Expand Down Expand Up @@ -158,8 +157,7 @@ img {
/* Size of content cannot exceed size of heading */
width: fit-content;
contain: none;
/* What does the 22px mean? I have no idea, it's a fudge factor to make it stop scrolling */
padding-inline: calc(50vw - var(--width-px, var(--slide-padding) - 100vw) / 2);
padding-inline: 3vmin;
box-sizing: content-box;
overflow: clip;

Expand Down

0 comments on commit 905d2d9

Please sign in to comment.