jQuery - Execute scripts based on screen size

前端 未结 4 1482

Is it possible to only run certain jQuery scripts if the screen/device size is above xxx pixels wide?

So, for example, I only want to run a slideshow when people are

4条回答
  •  广开言路
    2020-12-04 15:14

    You can use $(window).width()

    if($(window).width() >= 1024){
      // do your stuff
    }
    

    Demo ---> http://jsfiddle.net/fh2eC/1/

提交回复
热议问题