Skip to content

Instantly share code, notes, and snippets.

@jmuspratt
Last active March 15, 2018 18:44
Show Gist options
  • Save jmuspratt/f2ffda005cf7892ccf23649b78b80f78 to your computer and use it in GitHub Desktop.
Save jmuspratt/f2ffda005cf7892ccf23649b78b80f78 to your computer and use it in GitHub Desktop.
// Wordpress Admin bar breakpoints
$bp--admin-bar-sticks: 600px;
$bp--admin-bar-gets-taller: 783px;
// Wordpress Admin bar heights
$wp-narrow-offset: 46px;
$wp-wide-offset: 32px;
// Fixed-positioning that accounts for WP admin bar when present
@mixin admin-bar-fixed( $offset: 0 ) {
$narrow-offset: $wp-narrow-offset + $offset;
$wide-offset: $wp-wide-offset + $offset;
// without admin bar present, just use the passed value
top: $offset;
.admin-bar & {
top: $narrow-offset;
@media screen and (min-width: $bp--admin-bar-gets-taller) {
top: $wide-offset;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment