jeudi 30 juin 2016

If statement not working after minimization

I had an if statement inside a scroll function, to check if the div #homepage-flag or the div #landingspage-flag exists. It was something like this:

$(window).scroll(function(e){
    if($('#homepage-flag').length > 0 || $('#landingspage-flag').length > 0){
      // code
    }
});

I minified the code, but now the if statement only works for the div #landingspage-flag:

$("#homepage-flag").length > 0 || $("#landingspage-flag").length > 0 && $(window).scroll(function(l) {
  // code
})

Aucun commentaire:

Enregistrer un commentaire