Ads Manager 2 by Siropu

Ads Manager 2 by Siropu [Paid] 2.5.3

No permission to buy (€49.99)
@Siropu - can you see if option to renew ad for multiple months can be added, currently only when creating new ad multiple month option is available, but not when you would like to renew existing ad.
 
Try this code just below you actual ad code (for position "Sidebar below"):
Code:
<xf:js>
$(function()
{
     var unit = $('.samCodeUnit[data-position="container_sidebar_below"]');

     if (unit.length)
     {
          var unitOffset = unit.offset().top;

          $(window).scroll(function()
          {
               var unitScrollOffset = unit.offset().top;
               var scrollTop = $(document).scrollTop();

               if (unitScrollOffset - scrollTop <= 0)
               {
                    unit.css({position: 'fixed', top: $('.p-nav').height() + 10, width: 'auto'});
               }
               else if (scrollTop <= unitOffset)
               {
                    unit.css({position: '', top: '', width: ''});
               }
          });
     }
});
</xf:js>
Hi @Siropu , I have been using this code to make ads "sticky" in the sidebar. Unfortunately, this no longer works after the update from 2.2.16 to 2.3.3 (in Ads Manager 2.5.3). How do I have to modify the code? Thanks!
 
How do I have to modify the code?
Try this:

JavaScript:
<xf:js>
var unit = document.querySelector('.samCodeUnit[data-position="container_sidebar_below"]');

if (unit) {
    var unitOffset = unit.getBoundingClientRect().top + window.scrollY;

    window.addEventListener('scroll', function() {
        var unitScrollOffset = unit.getBoundingClientRect().top + window.scrollY;
        var scrollTop = window.scrollY;

        if (unitScrollOffset - scrollTop <= 0) {
            unit.style.position = 'fixed';
            unit.style.top = document.querySelector('.p-nav').offsetHeight + 10 + 'px';
            unit.style.width = 'auto';
        } else if (scrollTop <= unitOffset) {
            unit.style.position = '';
            unit.style.top = '';
            unit.style.width = '';
        }
    });
}
</xf:js>
 
Back
Top Bottom