I’m coding a sticky header using this code:
jQuery(function($) {
$(window).scroll(function() {
if(window.scrollY === 0) {
$(’.x-navbar .x-brand img’).attr(‘src’, ‘http://test.unknowndesign.co.za/wp-content/uploads/2018/02/UNKNOWN.svg’);
}
else
{
if ($(’.x-navbar’).hasClass(‘x-navbar-fixed-top’)) {
$(’.x-navbar-fixed-top .x-brand img’).attr(‘src’, ‘http://test.unknowndesign.co.za/wp-content/uploads/2018/02/U.svg’);
} else {
$(’.x-navbar .x-brand img’).attr(‘src’, ‘http://test.unknowndesign.co.za/wp-content/uploads/2018/02/UNKNOWN.svg’);
}
}
});
});
The code seems to have a delay and the sticky logo doesn’t transition smoothly. How can I give it a smooth transition without a delay?