How to make Foundation Apps Interchange load images as needed? -


the documentation foundation apps (and angular base apps, now-maintained fork of f4a) interchange gives example way load small size of image on mobile devices in order save bandwidth:

<ba-interchange>     <img media="small" src="assets/img/small.jpg">     <img media="medium" src="assets/img/medium.jpg">     <img media="large" src="assets/img/large.jpg"> </ba-interchange> 

however, while small image displayed, browser still sees 3 img tags , requests 3 images, before angular loaded. defeats purpose of using interchange @ all, @ least, if purpose save bandwidth.

the foundation 6 sites interchange avoids putting of images data-interchange attribute string on element instead. f4a have similar i'm missing? or there above example code i'm missing?

i suggest using ba-if directive provided angular base apps. directive internally uses ng-if directive, causing img element not added dom except when specified media query matched.

your code can re-written follows using ba-if directive:

<img ba-if="small only" src="assets/img/small.jpg"> <img ba-if="medium only" src="assets/img/medium.jpg"> <img ba-if="large only" src="assets/img/large.jpg"> 

Comments

Popular posts from this blog

java - Jasper subreport showing only one entry from the JSON data source when embedded in the Title band -

serialization - Convert Any type in scala to Array[Byte] and back -

SonarQube Plugin for Jenkins does not find SonarQube Scanner executable -