Skip to content

Commit 098dda5

Browse files
committed
make it easier to swap out placeholder icon
1 parent da2c13c commit 098dda5

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

javascripts/toggle-images.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
// import { sendEvent } from './events'
22

3+
const placeholderImagePath = '/assets/images/octicons/image.svg'
4+
35
// This module does two things:
46
// 1. Wraps every image in a div so they can be toggled individually.
57
// 2. Adds a button to toggle all images on the page.
@@ -97,7 +99,7 @@ function toggleImage (img, action, tooltipText) {
9799
parentButton.setAttribute('aria-label', tooltipText)
98100
} else {
99101
if (!img.getAttribute('originalSrc')) img.setAttribute('originalSrc', img.src)
100-
img.src = '/assets/images/octicons/image.svg'
102+
img.src = placeholderImagePath
101103
parentButton.setAttribute('aria-label', tooltipText)
102104
}
103105
}

0 commit comments

Comments
 (0)