Skip to content

Commit 4ad955a

Browse files
committed
fix: console errors from premature colorbox resize calls
1 parent 6a5e371 commit 4ad955a

File tree

1 file changed

+7
-1
lines changed
  • openlibrary/components/ObservationForm

1 file changed

+7
-1
lines changed

openlibrary/components/ObservationForm/Utils.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,12 @@ export function decodeAndParseJSON(str) {
88
return JSON.parse(decodeURIComponent(str));
99
}
1010

11+
/*
12+
window.$ is a jQuery object
13+
window.$.colorbox is a jQuery plugin
14+
*/
1115
export function resizeColorbox() {
12-
window.$.colorbox.resize();
16+
if (window.$ && window.$.colorbox && typeof window.$.colorbox.resize === 'function') {
17+
window.$.colorbox.resize();
18+
}
1319
}

0 commit comments

Comments
 (0)