javascript - How to use BBC's Imager.Js for responsive images in C# MVC -
i want use bbc imager.js library load responsive images on website based on device window size. have images of different sizes stored on server.
i have followed documentation of bbc-news/imager.js/ on github, not work due lack of knowledge. kindly me how accomplish task or there better technique work.
i resolved issue. going use old technique, days use <picture>
tags auto image selection based on browser size our image directory.
<picture> <source media="(min-width: 1024px)" srcset="www.example.com/image-large.jpg, www.example.com/image-large.jpg 2x"> <source media="(min-width: 768px)" srcset="www.example.com/image-medium.jpg, www.example.com/image-medium.jpg 2x"> <source media="(min-width: 480px)" srcset="www.example.com/image-mobile.jpg, www.example.com/image-mobile.jpg 2x"> <source srcset="www.example.com/image-small.jpg, www.example.com/image-small.jpg 2x"> <img src="www.example.com/image-mobile.jpg" alt="@item.title"> </picture>
the image tag in picture tag older browser support hope helpful.
Comments
Post a Comment