From e8235bbc1277bfe3728658db1171ab908ce163b2 Mon Sep 17 00:00:00 2001 From: Mark Boas Date: Thu, 11 Feb 2021 13:19:16 +0100 Subject: [PATCH] 24 detects if Velocity has been placed on the jQuery object --- js/hyperaudio-lite.js | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/js/hyperaudio-lite.js b/js/hyperaudio-lite.js index 691c9c4..0b33184 100644 --- a/js/hyperaudio-lite.js +++ b/js/hyperaudio-lite.js @@ -21,7 +21,8 @@ var hyperaudiolite = (function () { currentTime, windowHash, hashArray, - hashVar; + hashVar, + velocity; function init(mediaElementId, m) { @@ -160,6 +161,8 @@ var hyperaudiolite = (function () { } } } + + velocity = Velocity || jQuery.Velocity || window.jQuery.Velocity; } function getSelectionMediaFragment() { @@ -346,11 +349,14 @@ var hyperaudiolite = (function () { } if (currentParaIndex != paraIndex) { - Velocity(scrollNode, "scroll", { - container: transcript, - duration: 800, - delay: 0 - }); + + if (typeof velocity !== 'undefined') { + velocity(scrollNode, "scroll", { + container: transcript, + duration: 800, + delay: 0 + }); + } newPara = true;