Jquery Show and hide banner on scroll -


i'm trying show banner scrolling on 1000px. so, works need open , close 1 time.

here complete demo

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

Popular posts from this blog

sql server - Cannot query correctly (MSSQL - PHP - JSON) -

php - trouble displaying mysqli database results in correct order -

C++ Linked List -