[ad_1]
Hello
This is not a support request, I just gave an illustrative example of how badly the “beautiful code” function works for JS code, which is particularly important to me.
I would be happy to improve it.
Thank you
jQuery(function(){
var navIsBig = true;
var $nav = jQuery('#masthead .custom-logo');
var height_original = jQuery('#masthead .custom-logo').css("height").replace("px","");
var height_small = height_original * 0.666;
var width_original = jQuery('#masthead .custom-logo').css("width").replace("px","");
var width_small = width_original * 0.666;
jQuery(document).scroll( function() {
var value = jQuery(this).scrollTop();
if ( value > 100 && navIsBig ){
$nav.stop().animate({
height:height_small,width:width_small
},100);
navIsBig = false;
} else if (value <= 100 && !navIsBig ) {
$nav.stop().animate({
height:height_original,width:width_original
},100);
navIsBig = true;
}
});
});jQuery(function(){
var navIsBig = true;
var $nav = jQuery('#masthead .custom-logo');
var height_original = jQuery('#masthead .custom-logo').css("height").replace("px","");
var height_small = height_original * 0.666;
var width_original = jQuery('#masthead .custom-logo').css("width").replace("px","");
var width_small = width_original * 0.666;
jQuery(document).scroll( function() {
var value = jQuery(this).scrollTop();
if ( value > 100 && navIsBig ){
$nav.stop().animate({
height:height_small,width:width_small
}
,100);
navIsBig = false;
}
else if (value <= 100 && !navIsBig ) {
$nav.stop().animate({
height:height_original,width:width_original
}
,100);
navIsBig = true;
}
}
);
}
);
