javascript - How to refresh the page between window widths 480px to 768px? -
i using code:
// resize when less 768 $(document).ready(function(){ $(window).on('resize',function(){ if ($(window).width() < 768) { location.reload(); // refresh page } else { // width greater 768px pc } }); });
but reloads page when browser resized less 768px. possible have code reloads page on resize when browser say, between 480px , 768px? thanks!
yes, of course:
// resize when less 768 $(document).ready(function(){ $(window).on('resize',function(){ if (($(window).width() > 480) && ($(window).width() < 768)) { location.reload(); // refresh page } else { // width greater 768px pc // or width smaller 480 mobile } }); });
Comments
Post a Comment