diff --git a/js/hopscotch-0.0.5.js b/js/hopscotch-0.0.5.js index 6f7dffa7..ad1a1ea3 100644 --- a/js/hopscotch-0.0.5.js +++ b/js/hopscotch-0.0.5.js @@ -661,24 +661,15 @@ utils.removeClass(el, 'hide'); this.setPosition(step); utils.addClass(el, 'hide'); - // only want to adjust window scroll for non-fixed elements - if (callback && !step.fixedElement) { - callback(); - } - else { - this.show(); - } } else { // Don't care about height for the other orientations. this.setPosition(step); - // only want to adjust window scroll for non-fixed elements - if (callback && !step.fixedElement) { - callback(); - } - else { - this.show(); - } + } + + // only want to adjust window scroll for non-fixed elements + if (callback) { + callback(!step.fixedElement); } return this; @@ -1557,11 +1548,16 @@ } isLast = (stepNum === numTourSteps - 1); - bubble.render(step, stepNum, isLast, function() { + bubble.render(step, stepNum, isLast, function(adjustScroll) { // when done adjusting window scroll, call bubble.show() - adjustWindowScroll(function() { + if (adjustScroll) { + adjustWindowScroll(function() { + bubble.show(); + }); + } + else { bubble.show(); - }); + } if (step.onShow) { step.onShow(); } diff --git a/js/hopscotch-0.0.5.min.js b/js/hopscotch-0.0.5.min.js index d94b4326..d0d9f3fa 100644 --- a/js/hopscotch-0.0.5.min.js +++ b/js/hopscotch-0.0.5.min.js @@ -12,21 +12,21 @@ b.addClickListener(this.doneBtnEl,i.endTour);a.className="hopscotch-actions";thi a.innerHTML=l.closeTooltip;this.opt.isTourBubble?b.addClickListener(a,function(a){var c=i.getCurrStepNum(),d=i.getCurrTour(),f=c===d.steps.length-1;b.invokeCallbacks("close",[d.id,c]);i.endTour(!0,f);a.preventDefault?a.preventDefault():event&&(event.returnValue=!1)}):b.addClickListener(a,this._getCloseFn());this.closeBtnEl=a;this.containerEl.appendChild(a);return this},_initArrow:function(){var a,b;this.arrowEl=document.createElement("div");this.arrowEl.className="hopscotch-bubble-arrow-container"; b=document.createElement("div");b.className="hopscotch-bubble-arrow-border";a=document.createElement("div");a.className="hopscotch-bubble-arrow";this.arrowEl.appendChild(b);this.arrowEl.appendChild(a);this.element.appendChild(this.arrowEl);return this},render:function(a,e,c,d){var f=this.element,h,g;a?this.currStep=a:this.currStep&&(a=this.currStep);h=b.valOrDefault(a.showNextButton,this.opt.showNextButton);g=b.valOrDefault(a.showPrevButton,this.opt.showPrevButton);this.setTitle(a.title||"");this.setContent(a.content|| "");this.opt.showNumber&&this.setNum(e);this.orientation=a.orientation;this.opt.showNavButtons&&(this.showPrevButton(this.prevBtnEl&&g&&0g||g>=h.steps.length?null:h.steps[g]},t=function(){e.nextStep(!1)},z=function(a,d){var f,c;0<=g+a&&g+ad&&i.onPrev)i.onPrev();b.invokeCallbacks(0g?d:g,h=b.getScrollTop(),g=h+b.getWindowHeight(),m=e-f.scrollTopMargin,w,j,l;e>=h&&(e<=h+f.scrollTopMargin||d<=g)?a&&a():f.smoothScroll?"undefined"!==typeof YAHOO&&"undefined"!==typeof YAHOO.env&&"undefined"!==typeof YAHOO.env.ua&&"undefined"!== -typeof YAHOO.util&&"undefined"!==typeof YAHOO.util.Scroll?(e=YAHOO.env.ua.webkit?document.body:document.documentElement,d=YAHOO.util.Easing?YAHOO.util.Easing.easeOut:void 0,e=new YAHOO.util.Scroll(e,{scroll:{to:[0,m]}},f.scrollDuration/1E3,d),e.onComplete.subscribe(a),e.animate()):y?$("body, html").animate({scrollTop:m},f.scrollDuration,a):(0>m&&(m=0),w=h>e?-1:1,j=Math.abs(h-m)/(f.scrollDuration/10),l=function(){var c=b.getScrollTop(),d=c+w*j;0=m||0>w&&d<=m?(d=m,a&&a(),window.scrollTo(0,d)): -(window.scrollTo(0,d),b.getScrollTop()===c?a&&a():setTimeout(l,10))},l()):(window.scrollTo(0,m),a&&a());if(c.onShow)c.onShow();c.nextOnTargetClick&&b.addClickListener(k,t)});b.invokeCallbacks("show",[h.id,g]);c.multipage&&(e+=":mp");b.setState(f.cookieName,e,1)},c.delay||0);return this};this.prevStep=function(a){u.call(this,a,-1);return this};this.nextStep=function(a){var c=n(),d=b.getStepTarget(c);c.nextOnTargetClick&&b.removeClickListener(d,t);u.call(this,a,1);return this};this.endTour=function(a, -c){var d=s(),a=b.valOrDefault(a,!0),c=b.valOrDefault(c,!0);g=0;k=void 0;d.hide();a&&b.clearState(f.cookieName);i.isActive=!1;h&&c&&b.invokeCallbacks("end",[h.id]);i.removeCallbacks(!0);h=null;return this};this.getCurrTour=function(){return h};this.getCurrStepNum=function(){return g};this.listen=function(a,b,c){a&&b&&p[a].push({cb:b,fromTour:c});return this};this.removeCallback=function(a,b){var c=p[a],d,e;d=0;for(e=c.length;dg||g>=h.steps.length?null:h.steps[g]},t=function(){e.nextStep(!1)},z=function(a,d){var f,c;0<=g+a&&g+ad&&i.onPrev)i.onPrev();b.invokeCallbacks(0g?e:g,h=b.getScrollTop(),g=h+b.getWindowHeight(),m=a-f.scrollTopMargin,w,j,l;a>=h&&(a<=h+f.scrollTopMargin||e<=g)?d&&d():f.smoothScroll?"undefined"!==typeof YAHOO&&"undefined"!==typeof YAHOO.env&&"undefined"!==typeof YAHOO.env.ua&&"undefined"!==typeof YAHOO.util&& +"undefined"!==typeof YAHOO.util.Scroll?(a=YAHOO.env.ua.webkit?document.body:document.documentElement,e=YAHOO.util.Easing?YAHOO.util.Easing.easeOut:void 0,a=new YAHOO.util.Scroll(a,{scroll:{to:[0,m]}},f.scrollDuration/1E3,e),a.onComplete.subscribe(d),a.animate()):y?$("body, html").animate({scrollTop:m},f.scrollDuration,d):(0>m&&(m=0),w=h>a?-1:1,j=Math.abs(h-m)/(f.scrollDuration/10),l=function(){var a=b.getScrollTop(),c=a+w*j;0=m||0>w&&c<=m?(c=m,d&&d(),window.scrollTo(0,c)):(window.scrollTo(0, +c),b.getScrollTop()===a?d&&d():setTimeout(l,10))},l()):(window.scrollTo(0,m),d&&d())}else i.show();if(c.onShow)c.onShow();c.nextOnTargetClick&&b.addClickListener(k,t)});b.invokeCallbacks("show",[h.id,g]);c.multipage&&(e+=":mp");b.setState(f.cookieName,e,1)},c.delay||0);return this};this.prevStep=function(a){u.call(this,a,-1);return this};this.nextStep=function(a){var c=n(),d=b.getStepTarget(c);c.nextOnTargetClick&&b.removeClickListener(d,t);u.call(this,a,1);return this};this.endTour=function(a,c){var d= +s(),a=b.valOrDefault(a,!0),c=b.valOrDefault(c,!0);g=0;k=void 0;d.hide();a&&b.clearState(f.cookieName);i.isActive=!1;h&&c&&b.invokeCallbacks("end",[h.id]);i.removeCallbacks(!0);h=null;return this};this.getCurrTour=function(){return h};this.getCurrStepNum=function(){return g};this.listen=function(a,b,c){a&&b&&p[a].push({cb:b,fromTour:c});return this};this.removeCallback=function(a,b){var c=p[a],d,e;d=0;for(e=c.length;d