change background images on window resize

20 Views Asked by At

I have some divs with responsive background images set on css with media queries (I can't use images directly in HTML because I'm using "JQuery Ripples effect" on them).

The problem is on window resize: the background images doesn't refresh. I would like them to update as responsive images do when inserted directly into the HTML code.

The only solution I find was with javascript to refresh the entire page (not on small screens):

$(window).on('resize', function () {
  if ($(window).width() > 1200) {
  location.reload();
  }
});

but refreshing the entire page is annoying because the page split-up every time.

Some help please?

0

There are 0 best solutions below