I'm wanting to set a PHP variable based on window.innerWidth
.
For testing purposes, I have my browser at full size and document.write(window.innerWidth);
returns 1920, which seems to be right.
However, the code below is always returning "small" for the PHP variable $window_size
.
<script>
if(window.innerWidth > 1000){
<?php $window_size = 'big'; ?>
} else {
<?php $window_size = 'small'; ?>
}
</script>
Any ideas?