How to detect mobile width and change my css to it's current window width using jquery?
For Example
.page {
box-sizing: border-box;
-moz-box-sizing: border-box;
-webkit-box-sizing: border-box;
float: left;
margin: 40px 0;
max-width: 480px;
min-height: 720px;
height: auto;
min-width: 360px;
padding: 10px;
width: 100%;
}
and then I have this function but I am not sure if it's really working.
function responsiveFn() {
width = $(window).width();
document.getElementById('widthID').innerHTML = width;
jQuery('.page').css({
max-width: width
});
}
Thanks for the answer in advance! :)
max-widthinsidecssshould be covered in ' ' !! what you are getting as now?<div id="wrap"> <div data-role="page" id="index" class="page">#wrap { box-sizing: border-box; height: auto; overflow: hidden; width: 1200%; } Because it's a horizontal scrolling, I divided my pages in this 1200%.