Skip to content
This repository was archived by the owner on Feb 17, 2021. It is now read-only.

Commit 05fbd97

Browse files
committed
Merge pull request #82 from ykka/master
IE8 Button Bindings Fix and Updated README with refreshBubblePosition
2 parents 51ff529 + ee40dc9 commit 05fbd97

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

README.md

+2
Original file line numberDiff line numberDiff line change
@@ -255,6 +255,8 @@ The Hopscotch framework comes with a simple set of API calls with which you can
255255

256256
* `hopscotch.unlisten(eventName, callback)` - Removes a callback for one of the event types.
257257

258+
* `hopscotch.refreshBubblePosition()` - Redraws the bubble at a new position. Useful if element's position changes or if you need to keep bubble relative to the element when scrolling.
259+
258260
* `hopscotch.removeCallbacks(eventName[, tourOnly])` - Remove callbacks for hopscotch events. If tourOnly is set to true, only removes callbacks specified by a tour (callbacks set by hopscotch.configure or hopscotch.listen will remain). If eventName is null or undefined, callbacks for all events will be removed.
259261

260262
* `hopscotch.registerHelper(id, fn)` - Registers a callback helper. See the section about Helpers below.

src/js/hopscotch.js

+7-1
Original file line numberDiff line numberDiff line change
@@ -892,6 +892,12 @@
892892
_handleBubbleClick: function(evt){
893893
var action;
894894

895+
// Override evt for IE8 as IE8 doesn't pass event but binds it to window
896+
evt = evt || window.event; // get window.event if argument is falsy (in IE)
897+
898+
// get srcElement if target is falsy (IE)
899+
var targetElement = evt.target || evt.srcElement;
900+
895901
//Recursively look up the parent tree until we find a match
896902
//with one of the classes we're looking for, or the triggering element.
897903
function findMatchRecur(el){
@@ -911,7 +917,7 @@
911917
/*else*/ return findMatchRecur(el.parentElement);
912918
}
913919

914-
action = findMatchRecur(evt.target);
920+
action = findMatchRecur(targetElement);
915921

916922
//Now that we know what action we should take, let's take it.
917923
if (action === 'cta'){

0 commit comments

Comments
 (0)