Title: oddcomments's Replies | WordPress.org

---

# oddcomments

  [  ](https://wordpress.org/support/users/oddcomments/)

 *   [Profile](https://wordpress.org/support/users/oddcomments/)
 *   [Topics Started](https://wordpress.org/support/users/oddcomments/topics/)
 *   [Replies Created](https://wordpress.org/support/users/oddcomments/replies/)
 *   [Reviews Written](https://wordpress.org/support/users/oddcomments/reviews/)
 *   [Topics Replied To](https://wordpress.org/support/users/oddcomments/replied-to/)
 *   [Engagements](https://wordpress.org/support/users/oddcomments/engagements/)
 *   [Favorites](https://wordpress.org/support/users/oddcomments/favorites/)

 Search replies:

## Forum Replies Created

Viewing 1 replies (of 1 total)

 *   Forum: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
   
   In reply to: [Theme Customizer: Live Preview CSS by Media Query](https://wordpress.org/support/topic/theme-customizer-live-preview-css-by-media-query/)
 *  Thread Starter [oddcomments](https://wordpress.org/support/users/oddcomments/)
 * (@oddcomments)
 * [12 years, 3 months ago](https://wordpress.org/support/topic/theme-customizer-live-preview-css-by-media-query/#post-4552987)
 * I ended up getting the answer at stack**overflow**. If anyone runs into this,
   the answer is to wrap it in an `if ($(window).width() < 768)`. The modified code
   is as follows:
 *     ```
       if ($(window).width() < 768) {
       	wp.customize( 'background_color', function( value ) {
       		value.bind( function( newval ) {
       			$('nav').css('background-color', newval );
       		} );
       	} );
       }
       ```
   
 * One flaw, however, is that it doesn’t work if you start larger and resize. The
   response to that was to use `$(window).trigger('resize');` and load it on `$(
   document).ready(function() { $(window).trigger('resize'); });`

Viewing 1 replies (of 1 total)