Last active
June 3, 2023 13:01
-
-
Save jdsteinbach/f4d240894823bfd2c85c to your computer and use it in GitHub Desktop.
Generated by SassMeister.com.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.box-1 | |
.box-2 | |
.box-3 | |
.box-4 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ---- | |
// Sass (v3.4.12) | |
// Compass (v1.0.3) | |
// ---- | |
/* | |
* Mixin to compensate for the height of the admin bar | |
* for fixed position elements in WordPress themes | |
*/ | |
@mixin admin-sticky-fix( $offset: 0 ) { | |
$narrow-offset: 46px; | |
$wide-offset: 32px; | |
@if $offset != 0 and type-of($offset) == 'number' { | |
$narrow-offset: $narrow-offset + $offset; | |
$wide-offset: $wide-offset + $offset; | |
} | |
.admin-bar & { | |
top: $narrow-offset; | |
@media screen and (min-width: 783px) { | |
top: $wide-offset; | |
} | |
} | |
offset-type: type-of($offset); | |
} | |
.sticky-header { | |
position: fixed; | |
top: 0; | |
@include admin-sticky-fix; | |
} | |
.sticky-header-offset { | |
position: fixed; | |
top: 10px; | |
@include admin-sticky-fix(20px); | |
} | |
.sticky-header-fake-offset { | |
position: fixed; | |
top: 10px; | |
@include admin-sticky-fix(dumb); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* Mixin to compensate for the height of the admin bar | |
* for fixed position elements in WordPress themes | |
*/ | |
.sticky-header { | |
position: fixed; | |
top: 0; | |
offset-type: number; | |
} | |
.admin-bar .sticky-header { | |
top: 46px; | |
} | |
@media screen and (min-width: 783px) { | |
.admin-bar .sticky-header { | |
top: 32px; | |
} | |
} | |
.sticky-header-offset { | |
position: fixed; | |
top: 10px; | |
offset-type: number; | |
} | |
.admin-bar .sticky-header-offset { | |
top: 66px; | |
} | |
@media screen and (min-width: 783px) { | |
.admin-bar .sticky-header-offset { | |
top: 52px; | |
} | |
} | |
.sticky-header-fake-offset { | |
position: fixed; | |
top: 10px; | |
offset-type: string; | |
} | |
.admin-bar .sticky-header-fake-offset { | |
top: 46px; | |
} | |
@media screen and (min-width: 783px) { | |
.admin-bar .sticky-header-fake-offset { | |
top: 32px; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div class='box-1'></div> | |
<div class='box-2'></div> | |
<div class='box-3'></div> | |
<div class='box-4'></div> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment