Skip to content

Instantly share code, notes, and snippets.

@mebusw
Last active March 11, 2020 14:41
Show Gist options
  • Save mebusw/7f636a864556775dd8bc46bd83ea1c9e to your computer and use it in GitHub Desktop.
Save mebusw/7f636a864556775dd8bc46bd83ea1c9e to your computer and use it in GitHub Desktop.
customized autosizing top bar in Wordpress with beTheme
/* here's the customized CSS
@media only screen and (min-width: 768px) {
#mfn-rev-slider {
margin-top:70px;
}
}
@media only screen and (max-width: 767px) {
#mfn-rev-slider {
margin-top:0px;
}
}
*/
jQuery(function($){
window.onscroll = function() {scrollFunction()};
function scrollFunction() {
if (document.body.scrollTop > 0 || document.documentElement.scrollTop > 50) {
$("#Top_bar").css("height", "50px").css("transition", "0.5s");
$(".logo-main").css("height", "50%").css("transition", "0.5s"); //.attr("src", "https://www.uperform.cn/wp-content/uploads/2019/05/logo-cl1.png");
$(".menu_wrapper a").css("padding-top", "10px").css("padding-bottom", "10px").css("transition", "0.5s");
$("#logo").css("padding-top", "0px").css("transition", "0.5s");
} else {
$("#Top_bar").css("height", "70px").css("transition", "0.5s");
$(".logo-main").css("height", "100%").css("transition", "0.5s"); //.attr("src", "https://www.uperform.cn/wp-content/uploads/2019/08/logo-cr2.png");
$(".menu_wrapper a").css("padding-top", "20px").css("padding-bottom", "20px").css("transition", "0.5s");
$("#logo").css("padding-top", "10px").css("transition", "0.5s");
//.css('cssText': "top:22px !important")
}
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment