0
I want that when the width of the browser is between some values stipulated, my variable $colunas
assume different values.
I have the following code:
<?php
$largura = "<script type =text/javascript>var largura = document.body.clientWidth; document.write(largura); </script>";
echo $largura, '<br>';
$colunas = 0;
if ($largura > 1800) {
$colunas = 4;
}
else if (($largura >= 1450) and ($largura <= 1800)) {
$colunas = 3;
}
else if($largura <= 1449){
$colunas = 2;
}
echo $colunas;
But my variable $colunas
always receives the value equal to 2, independent of I change the width of the browser.
Browser width? I believe this should be done with javascript, otherwise you will have to load any changes.
– user28595