I have a breadcrumb in my website, but I want to truncate it when the screen is smaller than 480px. I am using the mb_strimwidth() function, but how do I detect if the screen is smaller than 480px with php?
Asked
Active
Viewed 62 times
1 Answers
1
Unfortunately you cannot retrieve the screen size in PHP.
You can however retrieve the screen-size using JavaScript, send it to PHP and store it somewhere for future reference (like in the database or a cookie) and then use that data to truncate.
If you use jQuery you can use .height
and .width
on $(document)
or $(window)
to get the size of the browser and the document.

deepy
- 473
- 4
- 20
-
Okay, that's a shame. I will try the javascript - php combination. Thanks for the fast answer! :) – Maarten Wolfsen Apr 15 '16 at 08:27