Trying to grab the screen size and add an if / else query, but for some reason I can't get it to work
What I'm looking for is if the screen width is larger / equal 480px, the following should be outputted:
{$pPage = $cWidth}
Else this:
{$pPage = 1}
This is what I have so far:
<script type="text/javascript">
(function($) {
$(document).ready(function() {
{$pPage = $cWidth}
})(jQuery);
</script>
Anybody out there with advice how to add the the query in reference to the screen.width, so that it also works?
try this:
using jquery:
if ($(window).width() < 1280) {
alert('Less than 1280');
}
else {
alert('More than 1280');
}
OR
using javascript:
var screensize = document.documentElement.clientWidth;
if (screensize < 1280) {
alert('Less than 1280');
}
else {
alert('More than 1280');
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With