Skip to content

Commit e7930be

Browse files
committed
add an option to select just some of the img tags to make their image retina
1 parent 1304e63 commit e7930be

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/retina.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@
66
// An option to choose a suffix for 2x images
77
retinaImageSuffix : "@2x",
88

9+
// An option to select some of the img tags to make their image retina.
10+
retinaImgTagSelector : "body img",
11+
912
// Ensure Content-Type is an image before trying to load @2x image
1013
// https://github.com/imulus/retinajs/pull/45)
1114
check_mime_type: true
@@ -28,7 +31,7 @@
2831
var existing_onload = context.onload || new Function;
2932

3033
context.onload = function() {
31-
var images = document.getElementsByTagName("img"), retinaImages = [], i, image;
34+
var images = document.querySelectorAll(config.retinaImgTagSelector), retinaImages = [], i, image;
3235
for (i = 0; i < images.length; i++) {
3336
image = images[i];
3437
retinaImages.push(new RetinaImage(image));

0 commit comments

Comments
 (0)