Yacine Jernite commited on
Commit
9639a64
·
1 Parent(s): 91f482a

fix sticky nav at launch

Browse files
js/pages/HomePage.js CHANGED
@@ -41,7 +41,9 @@ export function renderHomePage() {
41
  ${renderHomeNavigation()}
42
 
43
  ${renderContentSection('about-and-works', `
44
- <h3 id="about" class="text-xl md:text-2xl font-bold text-gray-900 mb-8 text-center">AI, ML, and Society</h3>
 
 
45
 
46
  <div class="space-y-4 text-gray-900 mb-10">
47
  <div class="text-base">
@@ -56,7 +58,7 @@ export function renderHomePage() {
56
  <div class="text-base leading-loose font-medium">
57
  The ${createInlineLink('Sustainability', '/sustainability', areasData.sustainability.color, areasData.sustainability.description.short)} of the technology, through better
58
  ${createInlineLink('measurement', '/sustainability#measuring', areasData.sustainability.topics.measuring.color, areasData.sustainability.topics.measuring.description.short)} and
59
- ${createInlineLink('efficiency', '/sustainability#efficiency', areasData.sustainability.topics.efficiency.color, areasData.sustainability.topics.efficiency.description.short)}.
60
  </div>
61
  </li>
62
 
@@ -75,7 +77,7 @@ export function renderHomePage() {
75
  The ${createInlineLink('Ecosystems', '/ecosystems', areasData.ecosystems.color, areasData.ecosystems.description.short)} that shape AI,
76
  including ${createInlineLink('economic', '/ecosystems#economy', areasData.ecosystems.topics.economy.color, areasData.ecosystems.topics.economy.description.short)} and
77
  ${createInlineLink('regulatory', '/ecosystems#regulation', areasData.ecosystems.topics.regulation.color, areasData.ecosystems.topics.regulation.description.short)} and the impact of
78
- ${createInlineLink('concentrations of resources', '/ecosystems#power', areasData.ecosystems.topics.power.color, areasData.ecosystems.topics.power.description.short)} on those.
79
  </div>
80
  </li>
81
  </ul>
 
41
  ${renderHomeNavigation()}
42
 
43
  ${renderContentSection('about-and-works', `
44
+ <h3 id="about" class="text-xl md:text-2xl font-bold text-gray-900 mb-4 text-center">
45
+ AI, ML, and Society
46
+ </h3>
47
 
48
  <div class="space-y-4 text-gray-900 mb-10">
49
  <div class="text-base">
 
58
  <div class="text-base leading-loose font-medium">
59
  The ${createInlineLink('Sustainability', '/sustainability', areasData.sustainability.color, areasData.sustainability.description.short)} of the technology, through better
60
  ${createInlineLink('measurement', '/sustainability#measuring', areasData.sustainability.topics.measuring.color, areasData.sustainability.topics.measuring.description.short)} and
61
+ ${createInlineLink('efficiency', '/sustainability#efficiency', areasData.sustainability.topics.efficiency.color, areasData.sustainability.topics.efficiency.description.short)} techniques.
62
  </div>
63
  </li>
64
 
 
77
  The ${createInlineLink('Ecosystems', '/ecosystems', areasData.ecosystems.color, areasData.ecosystems.description.short)} that shape AI,
78
  including ${createInlineLink('economic', '/ecosystems#economy', areasData.ecosystems.topics.economy.color, areasData.ecosystems.topics.economy.description.short)} and
79
  ${createInlineLink('regulatory', '/ecosystems#regulation', areasData.ecosystems.topics.regulation.color, areasData.ecosystems.topics.regulation.description.short)} and the impact of
80
+ ${createInlineLink('concentrations of resources', '/ecosystems#power', areasData.ecosystems.topics.power.color, areasData.ecosystems.topics.power.description.short)} on these.
81
  </div>
82
  </li>
83
  </ul>
js/utils/stickyNavigation.js CHANGED
@@ -18,10 +18,10 @@ export function initializeStickyNavigation(navElementId) {
18
  return;
19
  }
20
 
21
- // Calculate sticky threshold: when nav reaches bottom of header
22
  const headerHeight = parseInt(getComputedStyle(document.documentElement)
23
  .getPropertyValue('--header-height')) || 100;
24
- const stickyThreshold = navSection.offsetTop - headerHeight;
25
 
26
  // Scroll handler with throttling
27
  let scrollTimeout;
 
18
  return;
19
  }
20
 
21
+ // Calculate sticky threshold: when nav reaches bottom of header plus padding
22
  const headerHeight = parseInt(getComputedStyle(document.documentElement)
23
  .getPropertyValue('--header-height')) || 100;
24
+ const stickyThreshold = navSection.offsetTop - headerHeight + 16; // 16px padding
25
 
26
  // Scroll handler with throttling
27
  let scrollTimeout;