-
-
Save bnecreative/0fc12bf50a035ebea6c7ae73fb462ac6 to your computer and use it in GitHub Desktop.
Sweetness Dev - Affix Sidebar
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
/* | |
* 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' ); |
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
@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