I have these 3 jQuery functions that basically do the same thing, but they are a tiny bit different (width of window, and class that is removed/toggled)

I need the functionality of all these 3 functions, but want to somehow combine them/shorten them into one function. I've tried to but my code keeps breaking
Can anyone help to shorten them?

Here are the 3 functions

```
jQuery(document).ready(function($) {
  $('.exampleimg').click(function() {
    $('.about').hide(600);
    if (($(window).width() > 670) && ($(this).hasClass('exampleimgopen'))) {
      $(this).removeClass('exampleimgopen');
    } else if ($(window).width() > 670) {
      $('.exampleimg').removeClass('exampleimgopen');
      $(this).addClass('exampleimgopen');
    }
  });
});

jQuery(document).ready(function($) {
  $('.exampleimg').click(function() {
    $('.about').hide(600);
    if (($(window).width() < 670) && ($(this).hasClass('exampleimgopen2'))) {
      $(this).removeClass('exampleimgopen2');
    } else if ($(window).width() < 670) {
      $('.exampleimg').removeClass('exampleimgopen2');
      $(this).addClass('exampleimgopen2');
    }
  });
});

jQuery(document).ready(function($) {
  $('.exampleimg').click(function() {
    $('.about').hide(600);
    if (($(window).width() < 540) && ($(this).hasClass('exampleimgopen3'))) {
      $(this).removeClass('exampleimgopen3');
    } else if ($(window).width() < 540) {
      $('.exampleimg').removeClass('exampleimgopen3');
      $(this).addClass('exampleimgopen3');
    }
  });
});

```