javascript - Refresh page when container div is resized -
this simple , pretty straightforward question: if media query breakpoints set @ 750px , 970px, using jquery, possible refresh page after width of .container div changes on browser resize , how?
you want use media query instead but, can listen resize event if want this:
addeventlistener('resize', function() { location.reload(); });
if want reload if breakpoint past, can keep track of last innerwidth , reload if value crossed. or instead of using innerwidth, use width of div. example:
var last = document.getelementbyid('mydiv').clientwidth; addeventlistener('resize', function() { var current = document.getelementbyid('mydiv').clientwidth; if (current != last) location.reload(); last = current; });