jeudi 19 novembre 2015

Inside window scroll function multiple if else statement not working

How to add multiple if or else inside window scroll function? You can see the example below.

$(window).scroll(function() {

    var scroll = $(window).scrollTop();

    if (scroll <= 650) {
      $j('.innerimage').attr('src', 'images/side_1.png');
    }

    if (scroll >= 850) {
      $j('.innerimage').attr('src', 'images/side_2.png');
    }
});

Aucun commentaire:

Enregistrer un commentaire