0

I'm coding a website essentially for three different breakpoints (desktop, tablet, mobile). I have a javascript plugin running an automatic image change for my full width background. As I resize my window to the tablet and mobile breakpoints, can I disable the javascript plug in and make it stop running when the window is smaller than ***px?

  • 2
    No, but you could add a check to the Javascript `if screen.width < xxx....` – Pekka Nov 05 '13 at 02:31
  • Yes you can "disable" that javascript plugin. But the question is *how*. And that depends on what the plugin is, how it is coded, etc. – CrayonViolent Nov 05 '13 at 02:37
  • Depends entirely on the plugin, if/how it supports being disabled, if it supports automatically disabling itself under certain resolutions, etc... There is no way of answering this in the general case. – user229044 Nov 05 '13 at 05:00

1 Answers1

1
var minWidth = 800 // minimum width of screen
if ($(window).width() <= minSize) {
     // do nothing
}
else {
     // continue script
}

If you wanted it to be width as well as height:

if ($(window).width() <= minWidth && $(window).height() <= minHeight) {

Or something similar.

unclemeat
  • 5,029
  • 5
  • 28
  • 52