javascript - Show different number of images in different resolutions -


i have show on website 5 images in 1 row , resized using media queries can fit in screen. problem ex. in iphone 5s need show 3 images not 5 because small screen. in ipad , in devices larger screen need show 5. best way achieve this? should screen size via javascript , pass size server decide how many images should database or there way this? don't want use mobile site.

the problem not visual side. images need updated every x seconds need fetch different number of images database based on screen.

thanks

you can detect window size using jquery this:

$(window).width() $(window).height() 

if don't use jquery, can javascript:

window.screen.availheight window.screen.availwidth 

then pass these values server , decide images load.


Comments

Popular posts from this blog

resizing Telegram inline keyboard -

command line - How can a Python program background itself? -

php - "cURL error 28: Resolving timed out" on Wordpress on Azure App Service on Linux -