Home / Admin / gistfile1.txt
Duplicate Snippet

Embed Snippet on Your Site

gistfile1.txt

Code Preview
js
document.addEventListener('om.Campaign.afterShow', function(event) {
    if (event.detail.Campaign.id == 'zjd3hxxogbfvmy2iz0rp') // your slug
    {
        var campaignID = 'om-'+ event.detail.Campaign.id;
        var campaignHeight = document.getElementById(campaignID).offsetHeight;
        var fixedElement = document.getElementById('top'); //give ID for your fixed element OR document.querySelector('.yourClassName.yourSecondClassName');
        fixedElement.style.top = campaignHeight + 'px';
    }
});
document.addEventListener('om.Campaign.close', function(event) {
    var fixedElement = document.getElementById('top'); //give ID for your fixed element or document.querySelector('.yourClassName.yourSecondClassName');
    fixedElement.style.top = 0;
});

Comments

Add a Comment