$('.popup-promotion').on('load',function(){
if( scrollValue > 0){
$('.popup-promotion.user-ads-filter .container').css({top: scrollValue + "px", marginTop: "2%"})
} else {
$('.popup-promotion.user-ads-filter .container').css({marginTop: "2%"})
}
})
let sh = $('#show');
$('.popup-promotion').on('load',function(){
if( scrollValue > sh.offset().top+sh.heigth()){
$('.popup-promotion.user-ads-filter .container').css({top: scrollValue + "px", marginTop: "2%"})
} else {
$('.popup-promotion.user-ads-filter .container').css({marginTop: "2%"})
}
})
$(window).scroll(function(){
scrollValue = $(this).scrollTop();
if( scrollValue > 0){
$('.popup-promotion.user-ads-filter .container').css({'top' : scrollValue + 'px', 'margin-top' :'2%'});
} else {
$('.popup-promotion.user-ads-filter .container').css({'margin-top' : '2%'});
}
});
<div class="body">
<div class="popup-promotion user-ads-filter">
<div class="container">
</div>
</div>
</div>