/sticky-viewport-bookmarklet

Sticks the scroll position to an element as you resize the browser window. For observing element behaviour in responsive designs.

Primary LanguageHTMLMIT LicenseMIT

Sticky Viewport bookmarklet

Sometimes you want to see how an element behaves across breakpoints in a responsive design, but as you resize the browser window the element moves out of the viewport. Very frustrating!

This bookmarklet lets you mark an element as being "sticky" so that is it always centered in the viewport as you resize the browser window.

Install

  1. Create a new bookmark in your bookmarks toolbar
    • Name: Sticky Viewport
    • URL: Use the code in bookmarklet.js

How to use

  1. Navigate to the page you want to use it on
  2. Click on the Sticky Viewport button in your toolbar
  3. Move your mouse over the element that want to make sticky
  4. Click on the highlighted element to make it sticky
    • Try Alt+Click if the element captures the click and prevents it from doing the sticky business
  5. Resize the browser window so the layout changes and watch the sticky element stay in the center of the viewport

License

MIT