row to row-fluid with jQuery
Is it a good idea and is it the best way to do that ?
I just want to add -fluid to the class row or container if the screen < 1440 onload and on resize
and to refresh the page if it is resized under 1440
There is a shortest way to do that I guess
- $( window ).resize(function() {
-
- var width = $(window).width(), height = $(window).height();
-
- if (width < 1440) {
- $('.container').addClass('container-fluid');
- $('.container-fluid').removeClass('container');
- $('.row').addClass('row-fluid');
- $('.row-fluid').removeClass('row');
- location.reload(true);
- } else {
- $('.container-fluid').addClass('container');
- $('.container').removeClass('container-fluid');
- $('.row-fluid').addClass('row');
- $('.row').removeClass('row-fluid');
- }
- });
-
- $(document).ready(function() {
-
- var width = $(window).width(), height = $(window).height();
-
- if (width < 1440) {
- $('.container').addClass('container-fluid');
- $('.container-fluid').removeClass('container');
- $('.row').addClass('row-fluid');
- $('.row-fluid').removeClass('row');
- } else {
- $('.container-fluid').addClass('container');
- $('.container').removeClass('container-fluid');
- $('.row-fluid').addClass('row');
- $('.row').removeClass('row-fluid');
- }
-
- });
Thank you