Skip to content

Commit

Permalink
Merge pull request #13 from philipp-cliqz/master
Browse files Browse the repository at this point in the history
Make sure that the existing dialog is destroyed before creating a new one
  • Loading branch information
alvaroveliz committed May 14, 2018
2 parents e4dde96 + 46122b9 commit 03675cc
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions jquery.aSimpleTour.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,10 @@

var methods = {
init: function(opts, startFrom) {
if (started) {
methods.destroy();
}

options = $.extend(settings, opts);
startFrom = (typeof(startFrom) == 'undefined') ? null : startFrom-1;

Expand Down Expand Up @@ -326,6 +330,11 @@
return $element.css('background-color');
},
destroy: function() {
$('body').off('click', '#tourNext');
$('body').off('click', '#tourPrev');
$('body').off('click', '#tourEnd');
$('body').off('keydown');

$('#tourControls').remove();
$('#tourtip').remove();
$tooltip.css({ 'display': 'none' }).html('');
Expand Down

0 comments on commit 03675cc

Please sign in to comment.