0

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?

Maarten Wolfsen
  • 1,625
  • 3
  • 19
  • 35

1 Answers1

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