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

IE8 Button Bindings Fix and Updated README with refreshBubblePosition #82

Merged
merged 3 commits into from
May 7, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,8 @@ The Hopscotch framework comes with a simple set of API calls with which you can

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

* `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.

* `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.

* `hopscotch.registerHelper(id, fn)` - Registers a callback helper. See the section about Helpers below.
Expand Down
8 changes: 7 additions & 1 deletion src/js/hopscotch.js
Original file line number Diff line number Diff line change
Expand Up @@ -892,6 +892,12 @@
_handleBubbleClick: function(evt){
var action;

// Override evt for IE8 as IE8 doesn't pass event but binds it to window
evt = evt || window.event; // get window.event if argument is falsy (in IE)

// get srcElement if target is falsy (IE)
var targetElement = evt.target || evt.srcElement;

//Recursively look up the parent tree until we find a match
//with one of the classes we're looking for, or the triggering element.
function findMatchRecur(el){
Expand All @@ -911,7 +917,7 @@
/*else*/ return findMatchRecur(el.parentElement);
}

action = findMatchRecur(evt.target);
action = findMatchRecur(targetElement);

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