Jquery Show and hide banner on scroll -
i'm trying show banner scrolling on 1000px. so, works need open , close 1 time.
this .js
$(window).scroll(function () { if ($(this).scrolltop() > 1000) { $("#banner-promo").fadein("slow", function () {}); } else { // $('#backtotop').css({'visibility': 'hidden'}); $("#banner-promo").fadeout("slow", function () {}); } $("#chiudi").click(function(){ $("#banner-promo").fadeout("slow"); }); }); what's best practice that?
thanks in advance
based on comments, answer went make use of remove() take element away versus hiding it.
for example: https://jsfiddle.net/twisty/0go8snsl/
$("#banner-promo").remove();
Comments
Post a Comment