diff --git a/js/hopscotch-0.1.js b/js/hopscotch-0.1.js index 7c188c94..bb311f14 100644 --- a/js/hopscotch-0.1.js +++ b/js/hopscotch-0.1.js @@ -618,7 +618,7 @@ else if (step.placement === 'top' || step.placement === 'bottom') { arrowEl.style.top = ''; if (arrowOffset === 'center') { - arrowEl.style.left = bubbleWidth/2 - this.opt.arrowWidth/2 + 'px'; + arrowEl.style.left = bubbleWidth/2 + bubblePadding - arrowEl.getBoundingClientRect().width/2 + 'px'; } else { // Numeric pixel value @@ -629,7 +629,7 @@ arrowEl.style.left = ''; if (arrowOffset === 'center') { bubbleHeight = bubbleHeight || el.offsetHeight; - arrowEl.style.top = bubbleHeight/2 - this.opt.arrowWidth/2 + 'px'; + arrowEl.style.top = bubbleHeight/2 + bubblePadding - arrowEl.getBoundingClientRect().height/2 + 'px'; } else { // Numeric pixel value @@ -639,7 +639,7 @@ // HORIZONTAL OFFSET if (step.xOffset === 'center') { - left = (boundingRect.left + boundingRect.width/2) - (bubbleWidth/2); + left = (boundingRect.left + boundingRect.width/2) - (bubbleWidth/2) - bubblePadding; } else { left += utils.getPixelValue(step.xOffset); @@ -647,7 +647,7 @@ // VERTICAL OFFSET if (step.yOffset === 'center') { bubbleHeight = bubbleHeight || el.offsetHeight; - top = (boundingRect.top + boundingRect.height/2) - (bubbleHeight/2); + top = (boundingRect.top + boundingRect.height/2) - (bubbleHeight/2) - bubblePadding; } else { top += utils.getPixelValue(step.yOffset); diff --git a/js/hopscotch-0.1.min.js b/js/hopscotch-0.1.min.js index 6ae1ce10..25435043 100644 --- a/js/hopscotch-0.1.min.js +++ b/js/hopscotch-0.1.min.js @@ -1,37 +1,37 @@ -(function(u,v){var w,x,C,D,y,E=window.Sizzle||null,b,r,n,p,k=u[v],F=!1,G="undefined"!==typeof window.jQuery,s="undefined"!==typeof window.sessionStorage,h=window.document;p={smoothScroll:!0,scrollDuration:1E3,scrollTopMargin:200,showCloseButton:!0,showPrevButton:!1,showNextButton:!0,bubbleWidth:280,bubblePadding:15,arrowWidth:20,skipIfNoElement:!0,cookieName:"hopscotch.tour.state"};k||(Array.isArray||(Array.isArray=function(a){return"[object Array]"===Object.prototype.toString.call(a)}),b={addClass:function(a, -b){var c,e,d,i;if(a.className){e=b.split(/\s+/);c=" "+a.className+" ";d=0;for(i=e.length;dc.indexOf(" "+e[d]+" ")&&(c+=e[d]+" ");a.className=c.replace(/^\s+|\s+$/g,"")}else a.className=b},removeClass:function(a,b){var c,e,d,i;e=b.split(/\s+/);c=" "+a.className+" ";d=0;for(i=e.length;dc.indexOf(" "+f[d]+" ")&&(c+=f[d]+" ");a.className=c.replace(/^\s+|\s+$/g,"")}else a.className=b},removeClass:function(a,b){var c,f,d,i;f=b.split(/\s+/);c=" "+a.className+" ";d=0;for(i=f.length;dg||g>=i.steps.length?null:i.steps[g]},u=function(){f.nextStep(!1)},B=function(a,c){var e,f,d;0<=g+a&&g+af?e:f,d=b.getScrollTop(),f=d+b.getWindowHeight(),g=a-l("scrollTopMargin"),z,i,A;a>=d&&(a<=d+l("scrollTopMargin")||e<=f)?j&&j():l("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?h.body:h.documentElement,e=YAHOO.util.Easing?YAHOO.util.Easing.easeOut:void 0,a=new YAHOO.util.Scroll(a,{scroll:{to:[0,g]}}, -l("scrollDuration")/1E3,e),a.onComplete.subscribe(j),a.animate()):G?$("body, html").animate({scrollTop:g},l("scrollDuration"),j):(0>g&&(g=0),z=d>a?-1:1,i=Math.abs(d-g)/(l("scrollDuration")/10),A=function(){var a=b.getScrollTop(),c=a+z*i;0=g||0>z&&c<=g?(c=g,j&&j(),window.scrollTo(0,c)):(window.scrollTo(0,c),b.getScrollTop()===a?j&&j():setTimeout(A,10))},A()):(window.scrollTo(0,g),j&&j())}else j();c.nextOnTargetClick&&b.addEvtListener(k,"click",u)});c.multipage&&(f+=":mp");b.setState(l("cookieName"), -f,1)};this.getCalloutManager=function(){"undefined"===typeof e&&(e=new C);return e};this.startTour=function(a,c){var e,f=this;if(!i){i=a;var d={},h;for(h in a)a.hasOwnProperty(h)&&("id"!==h&&"steps"!==h)&&(d[h]=a[h]);s.call(this,d,!0);if(d=b.getState(l("cookieName")))d=d.split(":"),k=d[0],m=d[1],m=parseInt(m,10),2=i.steps.length)throw"Specified step number out of bounds.";g=c}if(!b.documentIsReady())return F=!0,this;!g&& -i.id===k&&"undefined"!==typeof m?g=m:g||(g=0);a:{var d=function(a){-1!==a&&b.getStepTarget(i.steps[a])?(b.invokeEventCallbacks("start"),e=t(),e.hide(!1),f.isActive=!0,b.getStepTarget(q())?f.showStep(a):(b.invokeEventCallbacks("error"),l("skipIfNoElement")&&f.nextStep(!1))):f.endTour(!1,!1)},j;h=!1;g=g||0;j=q();if(j=b.getStepTarget(j))d(g);else{if(0g||g>=i.steps.length?null:i.steps[g]},t=function(){e.nextStep(!1)},A=function(a,c){var f,e,d;0<=g+a&&g+af?e:f,d=b.getScrollTop(),f=d+b.getWindowHeight(),g=a-l("scrollTopMargin"),i,H,z;a>=d&&(a<=d+l("scrollTopMargin")||e<=f)?j&&j():l("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?h.body:h.documentElement,e=YAHOO.util.Easing?YAHOO.util.Easing.easeOut:void 0,a=new YAHOO.util.Scroll(a,{scroll:{to:[0,g]}}, +l("scrollDuration")/1E3,e),a.onComplete.subscribe(j),a.animate()):G?$("body, html").animate({scrollTop:g},l("scrollDuration"),j):(0>g&&(g=0),i=d>a?-1:1,H=Math.abs(d-g)/(l("scrollDuration")/10),z=function(){var a=b.getScrollTop(),c=a+i*H;0=g||0>i&&c<=g?(c=g,j&&j(),window.scrollTo(0,c)):(window.scrollTo(0,c),b.getScrollTop()===a?j&&j():setTimeout(z,10))},z()):(window.scrollTo(0,g),j&&j())}else j();c.nextOnTargetClick&&b.addEvtListener(k,"click",t)});c.multipage&&(f+=":mp");b.setState(l("cookieName"), +f,1)};this.getCalloutManager=function(){"undefined"===typeof f&&(f=new C);return f};this.startTour=function(a,c){var e,f=this;if(!i){i=a;var d={},h;for(h in a)a.hasOwnProperty(h)&&("id"!==h&&"steps"!==h)&&(d[h]=a[h]);n.call(this,d,!0);if(d=b.getState(l("cookieName")))d=d.split(":"),k=d[0],m=d[1],m=parseInt(m,10),2=i.steps.length)throw"Specified step number out of bounds.";g=c}if(!b.documentIsReady())return F=!0,this;!g&& +i.id===k&&"undefined"!==typeof m?g=m:g||(g=0);a:{var d=function(a){-1!==a&&b.getStepTarget(i.steps[a])?(b.invokeEventCallbacks("start"),e=u(),e.hide(!1),f.isActive=!0,b.getStepTarget(r())?f.showStep(a):(b.invokeEventCallbacks("error"),l("skipIfNoElement")&&f.nextStep(!1))):f.endTour(!1,!1)},j;h=!1;g=g||0;j=r();if(j=b.getStepTarget(j))d(g);else{if(0