title: Only execute JS if the screen size is more than 1024px?
body: <p>I have a sidebar that becomes position:fixed when the bottom of the div is visible (followed this <a href="http://techbrij.com/fixed-sidebar-scrolling-jquery-div" rel="nofollow">tutorial</a>). <strong>My problem is I only need the JS to work if the screen size is more than or equal to 1025px.</strong></p>
  
  <p>I know I need something along the lines of <code>if($(window).width() &gt; 1025)</code>, but I can't figure out where that needs to be. I'm not great with JS so any help would be appreciated.</p>
  
  <p><a href="http://jsfiddle.net/3w5dt/30/" rel="nofollow">Demo</a></p>
  
  <p>JS </p>
  
  <pre><code>$(function () {
  
  if ($('.leftsidebar').offset()!=null) {
  
      var top = $('.leftsidebar').offset().top - parseFloat($('.leftsidebar').css('margin-top').replace(/auto/, 0));
      var height = $('.leftsidebar').height();
      var winHeight = $(window).height();
      var footerTop = $('#footer').offset().top - parseFloat($('#footer').css('margin-top').replace(/auto/, 0));
      var gap = 100;
  
      $(window).scroll(function (event) {
      // what the y position of the scroll is
      var y = $(this).scrollTop();
  
      // whether that's below the form
      if (y+winHeight &gt;= top+ height+gap &amp;&amp; y+winHeight&lt;=footerTop) {
  
      // if so, ad the fixed class
      $('.leftsidebar').addClass('leftsidebarfixed').css('top',winHeight-height-gap +'px');
      }
      else if (y+winHeight&gt;footerTop) {
  
      // if so, add the fixed class
      $('.leftsidebar').addClass('leftsidebarfixed').css('top',footerTop-height-y-gap+'px');
      }
      else
      {
      // otherwise remove it
    $('.leftsidebar').removeClass('leftsidebarfixed').css('top','315px');
      }
    });
   }
  }
  </code></pre>