Bootstrap: Responsitive design - execute JS when window is resized from 980px to 979px

前端 未结 1 491
一向
一向 2021-01-05 15:11

I\'m using last Twitter\'s Bootstrap. I would like to execute a certain JS function (showing tooltip once) when my window\'s width is lower than 980px (as you know, on this

相关标签:
1条回答
  • 2021-01-05 15:43

    outerWidth is a method so you're missing ():

    if (window.outerWidth() == 980)
    

    In any case if you're using jQuery:

    $(window).resize(function() {
      if ($(this).width() < 981) {
        //do something
      }
    });
    
    0 讨论(0)
提交回复
热议问题