Skip to content

Commit

Permalink
Fixed the return to top link
Browse files Browse the repository at this point in the history
  • Loading branch information
natashapl committed Mar 27, 2024
1 parent a2225eb commit a40ea3f
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 118 deletions.
90 changes: 4 additions & 86 deletions _data/assetPaths.json
Original file line number Diff line number Diff line change
@@ -1,88 +1,6 @@
{
"poppin": "/assets/fonts/poppins",
"10x-lg.png": "/assets/images/10x-lg-transparent.png",
"10x_og_imag.png": "/assets/images/10x_og_image.png",
"access-to-data.png": "/assets/images/access-to-data-icon.png",
"benefits-eligibility.png": "/assets/images/benefits-eligibility-icon.png",
"brush.svg": "/assets/images/brush-stroke.svg",
"by-the-numbers.png": "/assets/images/by-the-numbers-bg.png",
"checkmark.svg": "/assets/images/checkmark-icon.svg",
"checkmar.svg": "/assets/images/checkmark.svg",
"close.svg": "/assets/images/close-x.svg",
"cloud_go.png": "/assets/images/cloud_gov.png",
"customer-experience.png": "/assets/images/customer-experience-icon.png",
"digitalgov.png": "/assets/images/digitalgov-logo.png",
"envelope.svg": "/assets/images/envelope-icon.svg",
"equity-project.png": "/assets/images/equity-project-icon.png",
"external-link.svg": "/assets/images/external-link-icon.svg",
"fb-share.png": "/assets/images/fb-share-img.png",
"featured-bg.png": "/assets/images/featured-bg-4.png",
"footer-brush.svg": "/assets/images/footer-brush-strokes.svg",
"fueling-innovation-callout.png": "/assets/images/fueling-innovation-callout-bg.png",
"funnel-arrow.png": "/assets/images/funnel-arrow-v.png",
"funnel.png": "/assets/images/funnel-bg.png",
"funnel-mobile.png": "/assets/images/funnel-mobile-bg.png",
"fy21": "/assets/images/fy21-report",
"grad-cap.svg": "/assets/images/grad-cap-icon.svg",
"gradient.png": "/assets/images/gradient-bg.png",
"gradient_her.png": "/assets/images/gradient_hero.png",
"gsa.svg": "/assets/images/gsa-logo.svg",
"header-bottom.png": "/assets/images/header-bottom-border.png",
"header-brush.png": "/assets/images/header-brush-stroke.png",
"home-brush.svg": "/assets/images/home-brush-strokes.svg",
"home-callout.png": "/assets/images/home-callout-bg.png",
"home-featured-brush-stroke.png": "/assets/images/home-featured-brush-stroke-4.png",
"home-hero-bg.png": "/assets/images/home-hero-bg-stroke.png",
"home.png": "/assets/images/home-x.png",
"homepage-gradient.png": "/assets/images/homepage-gradient-bg.png",
"in-a-nutshell.svg": "/assets/images/in-a-nutshell-background.svg",
"in-nutshell.png": "/assets/images/in-nutshell-header.png",
"left.svg": "/assets/images/left-arrow.svg",
"logo.png": "/assets/images/logo-alt.png",
"logo.svg": "/assets/images/logo-alt.svg",
"log.svg": "/assets/images/logo.svg",
"menu-close.png": "/assets/images/menu-close-X.png",
"menu.png": "/assets/images/menu-open.png",
"menu.svg": "/assets/images/menu-icon.svg",
"optimal-digital-experience.png": "/assets/images/optimal-digital-experience-icon.png",
"our-process-callout-bg.png": "/assets/images/our-process-callout-bg-mobile.png",
"our-process-callout.png": "/assets/images/our-process-callout-bg.png",
"our-story-brush-stroke.png": "/assets/images/our-story-brush-stroke-background.png",
"our-story-stat-1.png": "/assets/images/our-story-stat-1-background.png",
"our-story-stat-2.png": "/assets/images/our-story-stat-2-background.png",
"phase-circle.png": "/assets/images/phase-circle-tiger.png",
"phases.png": "/assets/images/phases-bg.png",
"phases-mobile-bg.png": "/assets/images/phases-mobile-bg-top.png",
"pitch-structure.png": "/assets/images/pitch-structure-bg.png",
"public-service.png": "/assets/images/public-service-icon.png",
"purple.svg": "/assets/images/purple-US.svg",
"quote.png": "/assets/images/quote-background.png",
"quote-mobile.png": "/assets/images/quote-mobile-background.png",
"quot.png": "/assets/images/quote.png",
"ring.png": "/assets/images/ring-separater.png",
"science-medicine.png": "/assets/images/science-medicine-icon.png",
"section2-purple.png": "/assets/images/section2-purple-bg.png",
"section2-purple.svg": "/assets/images/section2-purple-bg.svg",
"security-project.png": "/assets/images/security-project-icon.png",
"sewer": "/assets/images/sewer-spills",
"short-lilac-brush.png": "/assets/images/short-lilac-brush-stroke.png",
"short-ocean-brush.png": "/assets/images/short-ocean-brush-stroke.png",
"short-sky-brush.png": "/assets/images/short-sky-brush-stroke.png",
"short-tiger-brush.png": "/assets/images/short-tiger-brush-stroke.png",
"sprit.svg": "/assets/images/sprite.svg",
"submit-idea.png": "/assets/images/submit-idea-bg.png",
"submitter.svg": "/assets/images/submitter-icon.svg",
"team.svg": "/assets/images/team-icon.svg",
"technology.svg": "/assets/images/technology-services.svg",
"theme-2.png": "/assets/images/theme-2-bg.png",
"theme-5.png": "/assets/images/theme-5-bg.png",
"tts-inclusive-grid.png": "/assets/images/tts-inclusive-grid-map.png",
"tts-inclusive-grid.svg": "/assets/images/tts-inclusive-grid-map.svg",
"twitter-share.png": "/assets/images/twitter-share-img.png",
"uswd": "/assets/images/uswds",
"app.js": "/assets/js/app-2T4FNZ5M.js",
"app.map": "/assets/js/app-2T4FNZ5M.js.map",
"index.css": "/assets/styles/index-QYI7YS24.css",
"index.map": "/assets/styles/index-QYI7YS24.css.map",
"j": "/assets/uswds/js"
"app.js": "/assets/js/app-GTD5YFXX.js",
"app.map": "/assets/js/app-GTD5YFXX.js.map",
"index.css": "/assets/styles/index-RPFYCMUE.css",
"index.map": "/assets/styles/index-RPFYCMUE.css.map"
}
36 changes: 4 additions & 32 deletions _includes/layouts/investment-page.html
Original file line number Diff line number Diff line change
Expand Up @@ -35,37 +35,9 @@ <h3>{{ category }}</h3>
</div>
</div>

{% capture js %}
{% include "theme/js/sticky-return-to-top.js" %}
{% endcapture %}
<script>
// Set a variable for our Return to top button element.
const scrollToTopButton = document.getElementById('return-to-top-wrapper');
const leftNavBottom = document.getElementById('left-nav').getBoundingClientRect().bottom;
const leftNavBottomPosition = leftNavBottom - 20;

// Let's set up a function that shows our scroll-to-top button if we scroll beyond the height of the initial window.
const scrollFunc = () => {
const footerTop = document.getElementById('footer').offsetTop;
const footerTopPosition = footerTop - 20;

// Get the current scroll value
let y = window.scrollY;
let scrollPosition = window.pageYOffset || document.documentElement.scrollTop;

// If the scroll value is greater than the window height, let's add a class to the scroll-to-top button to show it!
if (y > 1000 && y < footerTop - window.innerHeight ) {
scrollToTopButton.className = "usa-identifier__required-links-item return-to-top margin-bottom-5 fixed";
} else {
scrollToTopButton.className = "usa-identifier__required-links-item return-to-top margin-bottom-5 not-fixed";
}
};

const checkWidthAndApplyStyle = () => {
if (window.innerWidth >= 1024) {
window.addEventListener("scroll", scrollFunc);
} else {
window.removeEventListener("scroll", scrollFunc);
}
}

window.addEventListener("scroll", scrollFunc);
window.addEventListener('resize', checkWidthAndApplyStyle);
{{ js | jsmin }}
</script>
4 changes: 4 additions & 0 deletions _includes/theme/js/sticky-return-to-top.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,12 @@ const checkWidthAndApplyStyle = () => {
window.addEventListener("scroll", scrollFunc);
} else {
window.removeEventListener("scroll", scrollFunc);
scrollToTopButton.className = "usa-identifier__required-links-item return-to-top margin-bottom-5 not-fixed";

}
}

checkWidthAndApplyStyle();

window.addEventListener("scroll", scrollFunc);
window.addEventListener('resize', checkWidthAndApplyStyle);

0 comments on commit a40ea3f

Please sign in to comment.