Javascript - execute multiple different [removed]

后端 未结 2 902
情话喂你
情话喂你 2020-12-31 19:05

I am facing a little problem here. I have basic knowledge about Javascript and i want to do the following:

Right now, when you scroll down, the menu will get smaller

相关标签:
2条回答
  • 2020-12-31 19:44

    You override onscroll function by doing window.onscroll = blabla

    You can do :

    window.onscroll = function() {
      effects();
      test();
    }
    

    or

    window.addEventListener('scroll', effects);
    window.addEventListener('scroll', test);
    
    0 讨论(0)
  • 2020-12-31 19:52

    You can use multiple listener for the scroll event.

    window.addEventListener('scroll', effects);
    window.addEventListener('scroll', test);
    

    That way you don't override window.onscroll

    0 讨论(0)
提交回复
热议问题