Skip to content

Instantly share code, notes, and snippets.

View karmaniverous's full-sized avatar

Jason Williscroft karmaniverous

View GitHub Profile
@karmaniverous
karmaniverous / semantic-react-sticky-sidebar.md
Last active October 24, 2022 02:31
Semantic React: Sticky Sidebar Inside Sidebar.Pushable

This gist is related to this Semantic React issue. The Semantic team closed the issue without actually fixing it: they just documented the problem and moved on. I NEEDED a fix, so here it is.

In brief, there's a use case for having a sticky menu in a desktop setting that turns into a sticky pushable overlay menu in a mobile setting.

Based on the Semantic React documentation, there's an obvious way to do this, but the behavior it produces is extremely wonky: the desktop sidebar menu sticks to the top of the window as expected until you scroll near the bottom, then zooms down and attaches to the BOTTOM of the screen.

Pretty awful. This appears to be a solid fix. I've only tested it in my own setup, but it should be fairly universal, or at least a good starting point!

In order to get the sticky sidebar/mobile overlay combo described above, you wo

@karmaniverous
karmaniverous / video-control.js
Last active July 21, 2021 04:19
Make a YouTube deep link scroll to the embedded video, skip to the time code, and start playing.
/*****
- Embed a YouTube video on a page.
- Put a deep link to the same video (https://youtu.be/1a2b3c4d5e6?t=123) into a container with class .tribify-video-control.
- When you click the link, the page will smooth-scroll to the embedded video, skip to the designated time code, and begin playing.
This example assumes you are running WordPress with jQuery and are using a standard YouTube embed iframe.
*****/
// Set up event handler. Only applies to a tags inside a container of class .tribify-video-control.
jQuery(document).on('ready', function() {

Keybase proof

I hereby claim:

  • I am karmaniverous on github.
  • I am karmaniverous (https://keybase.io/karmaniverous) on keybase.
  • I have a public key ASCAlp-n9b0a0kKgJHYXWWx9uwSaCjVS4b9gZWsGm_LtUgo

To claim this, I am signing this object: