Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Web and WebWorks Development

Reply
Highlighted
Trusted Contributor
Posts: 152
Registered: ‎02-12-2011
My Device: Not Specified

loading hi-res and low-res images

Hi,

 

is the<img> lowsrc attribute recognized in the blackberry web work?

 

I'm trying to find an effecient way to load images both hi and low res

 

i tired using a background-image on the <img> itself but doesn't seem to work to well. 

Developer
Posts: 68
Registered: ‎03-01-2011
My Device: Not Specified

Re: loading hi-res and low-res images

Hello icecappacino,

 

I'm not pretty sure regarding the lowsrc attribute on webworks since i haven't tried this yet but I hope that you won't mind if I suggest you something else. In my scripts, I took advantage of determining the dimensions of my screen using the screen.width/screen.height properties then makes use of this information to know what to display.

 

Something like this poorly written block of logic Smiley Happy :

if screen.height and screen.width is equal to high res
  imageRes = '_high'
else
  imageRes = '_low'

myImg.src="../pathToImg/myImg" + imageRes + ".jpg"
 

Please forgive me for the lack in specifics but hopefully this logic helps you. Smiley Wink

 

Also, if there's anyone out there who has some better idea, hope you'd be too kind to share Smiley Happy