From 8ba40052f981a645459294e2c9c666c52e1ab4b3 Mon Sep 17 00:00:00 2001 From: Gordon Koo Date: Tue, 31 Jul 2012 16:29:06 -0700 Subject: [PATCH] fix bouncing on window resize --- js/hopscotch-min.js | 2 +- js/hopscotch.js | 21 ++++++++++++--------- 2 files changed, 13 insertions(+), 10 deletions(-) diff --git a/js/hopscotch-min.js b/js/hopscotch-min.js index bc02d631..d1884044 100644 --- a/js/hopscotch-min.js +++ b/js/hopscotch-min.js @@ -1 +1 @@ -(function(){var i,c,h,g,f="undefined",a=(typeof window.jQuery!==f),d=(typeof window.localStorage!==f),e=document.body.style,b=(typeof e.MozTransition!==f||typeof e.MsTransition!==f||typeof e.webkitTransition!==f||typeof e.OTransition!==f||typeof e.transition!==f);if(window.hopscotch){return}g={addClass:function(l,n){var k,m,j;if(a){$(l).addClass(n)}else{if(l.className.length===0){l.className=n}else{k=l.className.split(" ");for(m=0,j=k.length;m0);this.showNextButton(this.nextBtnEl&&s&&!u);if(u){g.removeClass(this.doneBtnEl,"hide")}else{g.addClass(this.doneBtnEl,"hide")}this.setArrow(t.orientation);w=g.getPixelValue(t.width)||q.bubbleWidth;v=g.valOrDefault(t.padding,q.bubblePadding);this.containerEl.style.width=w+"px";this.containerEl.style.padding=v+"px";if(t.orientation==="top"){setTimeout(function(){m(z,t);if(y){y()}},5)}else{m(this,t);if(y){y()}}o=t.prevCallback;p=t.nextCallback;return this};this.setTitle=function(r){if(r){this.titleEl.innerHTML=r;g.removeClass(this.titleEl,"hide")}else{g.addClass(this.titleEl,"hide")}return this};this.setContent=function(r){if(r){this.contentEl.innerHTML=r;g.removeClass(this.contentEl,"hide")}else{g.addClass(this.contentEl,"hide")}return this};this.setNum=function(r){if(h.stepNums&&rD)?E:D,G=g.getScrollTop(),v=G+g.getWindowHeight(),w=A-50,u,z,y,I,x,B;if(a){$("body, html").animate({scrollTop:w},l.scrollDuration);return}else{if(typeof YAHOO!==f&&typeof YAHOO.env!==f&&typeof YAHOO.env.ua!==f&&typeof YAHOO.util!==f&&typeof YAHOO.util.Scroll!==f){u=YAHOO.env.ua.webkit?document.body:document.documentElement;y=YAHOO.util.Easing?YAHOO.util.Easing.easeOut:undefined;z=new YAHOO.util.Scroll(u,{scroll:{to:[0,w]}},l.scrollDuration/1000,y);z.animate();return}}if(w<0){w=0}if(A>=G&&A<=G+50){return}if(Av){if(l.smoothScroll){I=(G>A)?-1:1;x=Math.abs(G-A)/(l.scrollDuration/10);B=setInterval(function(){var M=g.getScrollTop(),L=M+(I*x);if((I>0&&L>=w)||I<0&&L<=w){L=w;clearInterval(B)}window.scrollTo(0,L);if(g.getScrollTop()===M){clearInterval(B)}},10)}else{window.scrollTo(0,w)}}};this.init=function(){var t,u;if(j){this.configure(j)}t=g.getState("hopscotch.tour.next");if(t){u=t.split(":");s=u[0];n=parseInt(u[1],10);if(u.length>2&&u[2]==="mp"){++n}}};this.loadTour=function(v){var u={},t,w;o=v;for(w in v){if(v.hasOwnProperty(w)&&w!=="id"&&w!=="steps"){u[w]=v[w]}}this.configure(u);t=m();t.showPrevButton(l.showPrevButton,true);t.showNextButton(l.showNextButton,true)};this.startTour=function(){var t;if(!o){throw"Need to load a tour before you start it!"}if(o.id===s&&typeof n!==f){k=n;if(!document.getElementById(o.steps[k].targetId)){if(k<=0||!document.getElementById(o.steps[--k].targetId)){this.endTour(false);return}}}else{k=0}this.showStep(k);t=m().show();if(l.animate){t.initAnimate()}this.isActive=true};this.showStep=function(w){var x=o.steps[w],v=o.steps.length,u=o.id+":"+w,t=m();if(!o){throw"No tour currently selected!"}k=w;t.renderStep(x,w,(w===v-1),p);if(x.multiPage){u+=":mp"}g.setState("hopscotch.tour.next",u,7)};this.prevStep=function(){if(k>0){this.showStep(--k)}};this.nextStep=function(){if(l.allNextCallback){l.allNextCallback(r(),k)}if(k0);this.showNextButton(this.nextBtnEl&&s&&!u);if(u){g.removeClass(this.doneBtnEl,"hide")}else{g.addClass(this.doneBtnEl,"hide")}this.setArrow(t.orientation);w=g.getPixelValue(t.width)||q.bubbleWidth;v=g.valOrDefault(t.padding,q.bubblePadding);this.containerEl.style.width=w+"px";this.containerEl.style.padding=v+"px";if(t.orientation==="top"){setTimeout(function(){m(z,t);if(y){y()}},5)}else{m(this,t);if(y){y()}}o=t.prevCallback;p=t.nextCallback;return this};this.setTitle=function(r){if(r){this.titleEl.innerHTML=r;g.removeClass(this.titleEl,"hide")}else{g.addClass(this.titleEl,"hide")}return this};this.setContent=function(r){if(r){this.contentEl.innerHTML=r;g.removeClass(this.contentEl,"hide")}else{g.addClass(this.contentEl,"hide")}return this};this.setNum=function(r){if(h.stepNums&&rD)?E:D,G=g.getScrollTop(),v=G+g.getWindowHeight(),w=A-50,u,z,y,I,x,B;if(a){$("body, html").animate({scrollTop:w},l.scrollDuration);return}else{if(typeof YAHOO!==f&&typeof YAHOO.env!==f&&typeof YAHOO.env.ua!==f&&typeof YAHOO.util!==f&&typeof YAHOO.util.Scroll!==f){u=YAHOO.env.ua.webkit?document.body:document.documentElement;y=YAHOO.util.Easing?YAHOO.util.Easing.easeOut:undefined;z=new YAHOO.util.Scroll(u,{scroll:{to:[0,w]}},l.scrollDuration/1000,y);z.animate();return}}if(w<0){w=0}if(A>=G&&A<=G+50){return}if(Av){if(l.smoothScroll){I=(G>A)?-1:1;x=Math.abs(G-A)/(l.scrollDuration/10);B=setInterval(function(){var M=g.getScrollTop(),L=M+(I*x);if((I>0&&L>=w)||I<0&&L<=w){L=w;clearInterval(B)}window.scrollTo(0,L);if(g.getScrollTop()===M){clearInterval(B)}},10)}else{window.scrollTo(0,w)}}};this.init=function(){var t,u;if(j){this.configure(j)}t=g.getState("hopscotch.tour.next");if(t){u=t.split(":");s=u[0];n=parseInt(u[1],10);if(u.length>2&&u[2]==="mp"){++n}}};this.loadTour=function(v){var u={},t,w;o=v;for(w in v){if(v.hasOwnProperty(w)&&w!=="id"&&w!=="steps"){u[w]=v[w]}}this.configure(u);t=m();t.showPrevButton(l.showPrevButton,true);t.showNextButton(l.showNextButton,true)};this.startTour=function(){var t;if(!o){throw"Need to load a tour before you start it!"}if(o.id===s&&typeof n!==f){k=n;if(!document.getElementById(o.steps[k].targetId)){if(k<=0||!document.getElementById(o.steps[--k].targetId)){this.endTour(false);return}}}else{k=0}this.showStep(k);t=m().show();if(l.animate){t.initAnimate()}this.isActive=true};this.showStep=function(w){var x=o.steps[w],v=o.steps.length,u=o.id+":"+w,t=m();if(!o){throw"No tour currently selected!"}k=w;t.renderStep(x,w,(w===v-1),p);if(x.multiPage){u+=":mp"}g.setState("hopscotch.tour.next",u,7)};this.prevStep=function(){if(k>0){this.showStep(--k)}};this.nextStep=function(){if(l.allNextCallback){l.allNextCallback(r(),k)}if(k