Hi,
I would like to know if it is possible to use the Fix CTA On Scroll 2.0 on the desktop version but not on mobile on the same Landing page.
I thought it would be easy, but I can’t figure out why the following script doesn’t work 🙂
script>
if ( lp.jQuery(window).width() <= 600 ) {
// Your mobile code goes here
}else{
script>
// Add ID of sticky CTA
var fixedCta = $(’#lp-pom-box-16’);
// DO NOT EDIT BELOW CODE
var ctaPos = fixedCta.offset();
var ctaLeft = ctaPos.left;
var ctaTop = ctaPos.top;
var fixedOn = ctaTop;
$(window).scroll(function () {
if ($(this).scrollTop() > fixedOn) {
fixedCta.css({
'position' : 'fixed',
'left': ctaLeft+'px',
'top': (ctaTop - fixedOn)+'px'
});
} else if ($(this).scrollTop() < fixedOn) {
fixedCta.css({
'position' : 'absolute',
'left': '1160px',
'top': (ctaTop)+'px'
});
}
});
/scrit>
}
/scrit>
Thanks a lot !