- Source:
Methods
contextHasHighDpi() → {Boolean}
Checks if the context would benefit from high DPI graphics.
- Source:
Returns:
true if device has high DPI, false if not or browser does not support media queries
- Type
- Boolean
Example
if( contextHasHighDpi() ){
document.querySelectorAll('img').forEach(img => {
img.setAttribute('src', img.getAttribute('src').replace('.jpg', '@2x.jpg'));
});
}