vendredi 5 février 2016

else if statement with different paremeters

I making some statements for site, and can't understand, how to make such type of statement. Here is the code

function checkWindowSize() {
  var pageWidth = $(window).width();
  if (pageWidth < 751) {
    $('.tab-content div').removeClass('tab-pane');
    $('#myTabs a').removeAttr("data-toggle", "tab");
  }
  else if (pageWidth < 751 && $(window).scrollTop()>=580;) {
    $('#faq .col-sm-3').addClass('fixed-faq');
    $('.tab-content div').addClass('padd-top');
  }
  else {
    $('#faq .col-sm-3').removeClass('fixed-faq');
    $('.tab-content div').removeClass('padd-top');
    $('#myTabs a').attr("data-toggle", "tab");
    $('.tab-content div').addClass('tab-pane');
  };
};
$(window).load(checkWindowSize);
$(window).resize(checkWindowSize);

It works fine with just only checking width and statements if, and else, but when I try make else if, with 2 parameters of check, the whole code stop working. Can someone help me ?

Aucun commentaire:

Enregistrer un commentaire