mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-09-10 18:22:37 -04:00
Make send yourself a test form stay at top of page
You might need to scroll this page quite a lot to see where a placeholder appears in your template – especially if you have a long email or letter. One of the things I’m trying to stop happening so much is a lot of scrolling back and forth. This would happen if you were scrolling down to see the placeholder, then back up to fill in its value. So this commit makes the textbox ‘sticky’, ie it always stays at the top of the viewport, even when you scroll down. This lets you see the placeholder and the textbox side by side, no matter how long the template is. The code to do this mostly comes from the GOV.UK Frontend Toolkit (documented here: https://github.com/alphagov/govuk_frontend_toolkit/blob/d9489a987086471fe30b4b925a81c12cd198c91d/docs/javascript.md#stick-at-top-when-scrolling). I had to add some extra CSS to make it look good when it overlaps the content of the page, which the GOV.UK Frontend Toolkit implementation doesn’t really anticipate.
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
// CSS adapted from
|
||||
// https://github.com/alphagov/govuk_frontend_toolkit/blob/d9489a987086471fe30b4b925a81c12cd198c91d/docs/javascript.md#stick-at-top-when-scrolling
|
||||
|
||||
.js-stick-at-top-when-scrolling {
|
||||
|
||||
overflow: hidden;
|
||||
margin-left: -$gutter-half;
|
||||
margin-top: -10px;
|
||||
padding: 10px 0 0 $gutter-half;
|
||||
|
||||
.form-group {
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
.content-fixed {
|
||||
position: fixed;
|
||||
top: 0;
|
||||
background: $white;
|
||||
z-index: 100;
|
||||
margin-top: 0;
|
||||
padding-right: $gutter-half;
|
||||
border-bottom: 1px solid $border-colour;
|
||||
box-shadow: 0 2px 0 0 rgba($border-colour, 0.2);
|
||||
}
|
||||
|
||||
.shim {
|
||||
display: block;
|
||||
}
|
||||
@@ -57,6 +57,7 @@ $path: '/static/images/';
|
||||
@import 'components/list-entry';
|
||||
@import 'components/letter';
|
||||
@import 'components/live-search';
|
||||
@import 'components/stick-at-top-when-scrolling';
|
||||
@import 'components/vendor/breadcrumbs';
|
||||
@import 'components/vendor/responsive-embed';
|
||||
|
||||
|
||||
Reference in New Issue
Block a user