vendredi 23 mars 2018

Stuck with an IF condition with two variables

I'm trying to change an image multple times on my webpage for different sections, but I'm stuck maybe in a simple solution.

Here is my jquery for this issue. The idea is to change the image between 1200 and 1900 and then change it again between 2500 and 3500.

Please somebody help me out!!

Thanks a lot.

var $logo = $("h6.navbar-brand-spacing > a");
$(window).scroll(function () {
  var e = $(this).scrollTop();
  if ((e > 1200 && e < 1900) && (e > 2500 && e < 3500)) {
    $logo.addClass('navbar-brand-scroll');
  } else {
    $logo.removeClass('navbar-brand-scroll');
  }
});

Aucun commentaire:

Enregistrer un commentaire