Skip to content

Instantly share code, notes, and snippets.

@bnecreative
Last active January 24, 2017 23:49
Show Gist options
  • Save bnecreative/0fc12bf50a035ebea6c7ae73fb462ac6 to your computer and use it in GitHub Desktop.
Save bnecreative/0fc12bf50a035ebea6c7ae73fb462ac6 to your computer and use it in GitHub Desktop.
Sweetness Dev - Affix Sidebar
/*
* Add opening affix DIV tag.
*/
function my_affix_top() {
echo '<div data-spy="affix" data-offset-top="140" class="affix-sidebar">';
}
add_action( 'bne_sidebar_before', 'my_affix_top');
/*
* Add closing affix DIV tag.
*/
function my_affix_bottom() {
echo '</div><!-- .affix (end) -->';
}
add_action( 'bne_sidebar_after', 'my_affix_bottom' );
@media (min-width: 992px) {
.affix-sidebar.affix {
top: 75px; /* Top Position */
width: 294px; /* Widget Width (small desktop) */
}
}
@media (min-width: 1200px) {
.affix-sidebar.affix {
width: 340px; /* Widget Width (large desktop) */
}
}
@media (max-width: 991px) {
.affix-sidebar.affix {
position: static;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment