Page scroll to id - Version 1.5.6

Version Description

  • Changed the way 'Force single highlight' option works. When enabled, it now highlights the first highlighted element instead of last.
  • Extended highlight and target classes with additional ones in order to differentiate the first and last elements. You can now use .mPS2id-highlight-first, .mPS2id-highlight-last, .mPS2id-target-first and .mPS2id-target-last in order to target the first and last highlighted links and targets in your CSS.
  • Added 'Keep highlight until next' option. When enabled, the plugin will keep the current link/target highlighted until the next one comes into view (one element always stays highlighted).
  • Added 'Disable plugin below screen-size' option. Set the screen-size (in pixels), below which the plugin will be disabled.
Download this release

Release Info

Developer malihu
Plugin Icon 128x128 Page scroll to id
Version 1.5.6
Comparing to
See all releases

Code changes from version 1.5.5 to 1.5.6

includes/help/plugin-settings.inc CHANGED
@@ -48,7 +48,7 @@ $help_plugin_settings_text=<<<EOD
48
 
49
  <p>
50
  <strong>Classes</strong> -
51
- Set the classes added to links by the plugin:
52
  </p>
53
 
54
  <ol>
@@ -58,7 +58,15 @@ $help_plugin_settings_text=<<<EOD
58
  </ol>
59
 
60
  <p>
61
- By checking "Force single highlight", only one highlighted element is allowed at a time.
 
 
 
 
 
 
 
 
62
  </p>
63
 
64
  <p>
@@ -67,6 +75,11 @@ $help_plugin_settings_text=<<<EOD
67
  Enable when you need to scroll to an id in another page.
68
  </p>
69
 
 
 
 
 
 
70
  EOD;
71
  ?>
72
 
48
 
49
  <p>
50
  <strong>Classes</strong> -
51
+ Set the classes added to links and targets by the plugin:
52
  </p>
53
 
54
  <ol>
58
  </ol>
59
 
60
  <p>
61
+ In addition, the plugin will add the above classes with the <code>-first</code> and <code>-last</code> suffix (e.g. <code>mPS2id-highlight-first</code>, <code>mPS2id-highlight-last</code>) in order to differentiate multiple highlighted elements. This is useful when you need to style only the first or last of the highlighted links or targets in your CSS.
62
+ </p>
63
+
64
+ <p>
65
+ By checking "Force single highlight", only one highlighted element (the first one) is allowed at a time.
66
+ </p>
67
+
68
+ <p>
69
+ Check "Keep highlight until next" when you need to keep the current element highlighted until the next one comes into view. This way at least one element always stays highlighted.
70
  </p>
71
 
72
  <p>
75
  Enable when you need to scroll to an id in another page.
76
  </p>
77
 
78
+ <p>
79
+ <strong>Disable plugin below screen-size</strong> -
80
+ Set a minimum width and/or height screen-size (in pixels) that's required for the plugin to be enabled. For example, insert <code>1024</code> to disable plugin functionality when window width is below 1024 pixels or <code>1024,600</code> to disable plugin when window width/height is below 1024 and 600 pixels respectively. Leave field value empty or set to 0 to disable.<br />
81
+ </p>
82
+
83
  EOD;
84
  ?>
85
 
js/jquery.malihu.PageScroll2id-init.js CHANGED
@@ -13,6 +13,14 @@
13
  }else{
14
  return val;
15
  }
 
 
 
 
 
 
 
 
16
  };
17
  $(document).ready(function(){
18
  for(var k=0; k<_o.total_instances; k++){
@@ -53,7 +61,9 @@
53
  clickedClass:_o.instances[_p+"_instance_"+i]["clickedClass"]["value"],
54
  targetClass:_o.instances[_p+"_instance_"+i]["targetClass"]["value"],
55
  highlightClass:_o.instances[_p+"_instance_"+i]["highlightClass"]["value"],
56
- forceSingleHighlight:(_o.instances[_p+"_instance_"+i]["forceSingleHighlight"]["value"]==="true") ? true : false
 
 
57
  });
58
  //scroll to location hash on page load
59
  if(_o.instances[_p+"_instance_"+i]["scrollToHash"]["value"]==="true" && _hash){
13
  }else{
14
  return val;
15
  }
16
+ },
17
+ _screen=function(val){
18
+ if(val.indexOf(",")!==-1){
19
+ var arr=val.split(","),x=arr[0] || "0",y=arr[1] || "0";
20
+ return [x,y];
21
+ }else{
22
+ return val;
23
+ }
24
  };
25
  $(document).ready(function(){
26
  for(var k=0; k<_o.total_instances; k++){
61
  clickedClass:_o.instances[_p+"_instance_"+i]["clickedClass"]["value"],
62
  targetClass:_o.instances[_p+"_instance_"+i]["targetClass"]["value"],
63
  highlightClass:_o.instances[_p+"_instance_"+i]["highlightClass"]["value"],
64
+ forceSingleHighlight:(_o.instances[_p+"_instance_"+i]["forceSingleHighlight"]["value"]==="true") ? true : false,
65
+ keepHighlightUntilNext:(_o.instances[_p+"_instance_"+i]["keepHighlightUntilNext"]["value"]==="true") ? true : false,
66
+ disablePluginBelow:_screen(_o.instances[_p+"_instance_"+i]["disablePluginBelow"]["value"].toString())
67
  });
68
  //scroll to location hash on page load
69
  if(_o.instances[_p+"_instance_"+i]["scrollToHash"]["value"]==="true" && _hash){
js/jquery.malihu.PageScroll2id.js CHANGED
@@ -1 +1,2 @@
1
- (function(d,h,l,e){var c="mPageScroll2id",i="mPS2id",t=".m_PageScroll2id,a[rel~='m_PageScroll2id'],.page-scroll-to-id,a[rel~='page-scroll-to-id']",j={scrollSpeed:1300,autoScrollSpeed:true,scrollEasing:"easeInOutExpo",scrollingEasing:"easeInOutCirc",pageEndSmoothScroll:true,layout:"vertical",offset:0,highlightSelector:false,clickedClass:i+"-clicked",targetClass:i+"-target",highlightClass:i+"-highlight",forceSingleHighlight:false,clickEvents:true,onStart:function(){},onComplete:function(){},defaultSelector:false},p,b,g,a,q,f,n,o,m,r,s={init:function(u){var u=d.extend(true,{},j,u);d(l).data(i,u);b=d(l).data(i);p=(!p)?this.selector:p+","+this.selector;if(b.defaultSelector){if(typeof d(p)!=="object"||d(p).length===0){p=t}}if(b.clickEvents){d(l).undelegate("."+i).delegate(p,"click."+i,function(x){var w=d(this),v=w.attr("href"),y=w.prop("href");if(v&&v.indexOf("#/")!==-1){return}k._reset.call(null);r=w.data("ps2id-offset")||0;if(k._isValid.call(null,v,y)&&k._findTarget.call(null,v)){x.preventDefault();a="selector";q=w;k._setClasses.call(null,true);k._scrollTo.call(null)}})}d(h).unbind("."+i).bind("scroll."+i+" resize."+i,function(){var v=d("._"+i+"-t");v.each(function(){var w=d(this),y=w.attr("id"),x=k._findHighlight.call(null,y);k._setClasses.call(null,false,w,x)})});g=true;k._setup.call(null)},scrollTo:function(w,u){if(w&&typeof w!=="undefined"){k._isInit.call(null);var v={layout:b.layout,offset:b.offset,clicked:false},u=d.extend(true,{},v,u);k._reset.call(null);o=u.layout;m=u.offset;w=(w.indexOf("#")!==-1)?w:"#"+w;if(k._isValid.call(null,w)&&k._findTarget.call(null,w)){a="scrollTo";q=u.clicked;if(q){k._setClasses.call(null,true)}k._scrollTo.call(null)}}},destroy:function(){d(h).unbind("."+i);d(l).undelegate("."+i).removeData(i);d("."+b.clickedClass).removeClass(b.clickedClass);d("."+b.targetClass).removeClass(b.targetClass);d("."+b.highlightClass).removeClass(b.highlightClass);d("._"+i+"-t").removeData(i).removeClass("_"+i+"-t");d("._"+i+"-h").removeClass("_"+i+"-h")}},k={_isValid:function(u,x){if(!u){return}x=(!x)?u:x;var w=(x.indexOf("#/")!==-1)?x.split("#/")[0]:x.split("#")[0],v=h.location.toString().split("#")[0];return u!=="#"&&u.indexOf("#")!==-1&&(w===""||w===v)},_setup:function(){var v=(b.highlightSelector&&b.highlightSelector!=="")?b.highlightSelector:p,u=1;return d(v).each(function(){var z=d(this),w=z.attr("href"),B=z.prop("href");if(k._isValid.call(null,w,B)){var A=(w.indexOf("#/")!==-1)?w.split("#/")[1]:w.split("#")[1],x=d("#"+A);if(x.length>0){if(!x.hasClass("_"+i+"-t")){x.addClass("_"+i+"-t").data(i,{i:u})}if(!z.hasClass("_"+i+"-h")){z.addClass("_"+i+"-h")}var y=k._findHighlight.call(null,A);k._setClasses.call(null,false,x,y);u++}}})},_findTarget:function(w){var v=(w.indexOf("#/")!==-1)?w.split("#/")[1]:w.split("#")[1],u=d("#"+v);if(u.length<1||u.css("position")==="fixed"){if(v==="top"){u=d("body")}else{return}}f=u;if(!o){o=b.layout}m=k._setOffset.call(null);n=[(u.offset().top-m[0]).toString(),(u.offset().left-m[1]).toString()];n[0]=(n[0]<0)?0:n[0];n[1]=(n[1]<0)?0:n[1];return n},_setOffset:function(){if(!m){m=(b.offset)?b.offset:0}if(r){m=r}var w,v,z,u;switch(typeof m){case"object":case"string":w=[(m.y)?m.y:m,(m.x)?m.x:m];v=[(w[0] instanceof jQuery)?w[0]:d(w[0]),(w[1] instanceof jQuery)?w[1]:d(w[1])];if(v[0].length>0){z=v[0].height();if(v[0].css("position")==="fixed"){z+=v[0][0].offsetTop}}else{if(!isNaN(parseFloat(w[0]))&&isFinite(w[0])){z=parseInt(w[0])}else{z=0}}if(v[1].length>0){u=v[1].width();if(v[1].css("position")==="fixed"){u+=v[1][0].offsetLeft}}else{if(!isNaN(parseFloat(w[1]))&&isFinite(w[1])){u=parseInt(w[1])}else{u=0}}break;case"function":w=m.call(null);if(w instanceof Array){z=w[0];u=w[1]}else{z=u=w}break;default:z=u=parseInt(m)}return[z,u]},_findHighlight:function(z){var y=h.location.toString().split("#")[0],v=d("._"+i+"-h[href='#"+z+"']"),w=d("._"+i+"-h[href='"+y+"#"+z+"']"),u=d("._"+i+"-h[href='#/"+z+"']"),x=d("._"+i+"-h[href='"+y+"#/"+z+"']");v=(v.length>0)?v:w;u=(u.length>0)?u:x;return(u.length>0)?u:v},_setClasses:function(z,v,w){var y=b.clickedClass,u=b.targetClass,x=b.highlightClass;if(z&&y&&y!==""){d("."+y).removeClass(y);q.addClass(y)}else{if(v&&u&&u!==""&&w&&x&&x!==""){if(k._currentTarget.call(null,v)){if(b.forceSingleHighlight){d("."+x).removeClass(x)}v.addClass(u);w.addClass(x)}else{v.removeClass(u);w.removeClass(x)}}}},_currentTarget:function(H){var K=b["target_"+H.data(i).i],w=H[0].getBoundingClientRect();if(typeof K!=="undefined"){var F=H.offset().top,G=H.offset().left,L=(K.from)?K.from+F:F,z=(K.to)?K.to+F:F,I=(K.fromX)?K.fromX+G:G,v=(K.toX)?K.toX+G:G;return(w.top>=z&&w.top<=L&&w.left>=v&&w.left<=I)}else{var D=d(h).height(),O=d(h).width(),C=H.height(),N=H.width(),B=1+(C/D),J=B,E=(C<D)?B*(D/C):B,u=1+(N/O),A=u,M=(N<O)?u*(O/N):u;return(w.top<=D/J&&w.bottom>=D/E&&w.left<=O/A&&w.right>=O/M)}},_scrollTo:function(){b.scrollSpeed=parseInt(b.scrollSpeed);n=(b.pageEndSmoothScroll)?k._pageEndSmoothScroll.call(null):n;var v=d("html,body"),x=(b.autoScrollSpeed)?k._autoScrollSpeed.call(null):b.scrollSpeed,z=(v.is(":animated"))?b.scrollingEasing:b.scrollEasing,w=d(h).scrollTop(),u=d(h).scrollLeft();switch(o){case"horizontal":if(u!=n[1]){k._callbacks.call(null,"onStart");v.stop().animate({scrollLeft:n[1]},x,z).promise().then(function(){k._callbacks.call(null,"onComplete")})}break;case"auto":if(w!=n[0]||u!=n[1]){k._callbacks.call(null,"onStart");if(navigator.userAgent.match(/(iPod|iPhone|iPad|Android)/)){var y;v.stop().animate({pageYOffset:n[0],pageXOffset:n[1]},{duration:x,easing:z,step:function(A,B){if(B.prop=="pageXOffset"){y=A}else{if(B.prop=="pageYOffset"){h.scrollTo(y,A)}}}}).promise().then(function(){k._callbacks.call(null,"onComplete")})}else{v.stop().animate({scrollTop:n[0],scrollLeft:n[1]},x,z).promise().then(function(){k._callbacks.call(null,"onComplete")})}}break;default:if(w!=n[0]){k._callbacks.call(null,"onStart");v.stop().animate({scrollTop:n[0]},x,z).promise().then(function(){k._callbacks.call(null,"onComplete")})}}},_pageEndSmoothScroll:function(){var u=d(l).height(),x=d(l).width(),w=d(h).height(),v=d(h).width();return[((u-n[0])<w)?u-w:n[0],((x-n[1])<v)?x-v:n[1]]},_autoScrollSpeed:function(){var w=d(h).scrollTop(),v=d(h).scrollLeft(),x=d(l).height(),u=d(l).width(),y=[b.scrollSpeed+((b.scrollSpeed*(Math.floor((Math.abs(n[0]-w)/x)*100)))/100),b.scrollSpeed+((b.scrollSpeed*(Math.floor((Math.abs(n[1]-v)/u)*100)))/100)];return Math.max.apply(Math,y)},_callbacks:function(u){if(!b){return}this[i]={trigger:a,clicked:q,target:f,scrollTo:{y:n[0],x:n[1]}};switch(u){case"onStart":b.onStart.call(null,this[i]);break;case"onComplete":b.onComplete.call(null,this[i]);break}},_reset:function(){o=m=r=false},_isInit:function(){if(!g){s.init.apply(this)}},_easing:function(){d.easing.easeInQuad=d.easing.easeInQuad||function(v,w,u,z,y){return z*(w/=y)*w+u};d.easing.easeOutQuad=d.easing.easeOutQuad||function(v,w,u,z,y){return -z*(w/=y)*(w-2)+u};d.easing.easeInOutQuad=d.easing.easeInOutQuad||function(v,w,u,z,y){if((w/=y/2)<1){return z/2*w*w+u}return -z/2*((--w)*(w-2)-1)+u};d.easing.easeInCubic=d.easing.easeInCubic||function(v,w,u,z,y){return z*(w/=y)*w*w+u};d.easing.easeOutCubic=d.easing.easeOutCubic||function(v,w,u,z,y){return z*((w=w/y-1)*w*w+1)+u};d.easing.easeInOutCubic=d.easing.easeInOutCubic||function(v,w,u,z,y){if((w/=y/2)<1){return z/2*w*w*w+u}return z/2*((w-=2)*w*w+2)+u};d.easing.easeInQuart=d.easing.easeInQuart||function(v,w,u,z,y){return z*(w/=y)*w*w*w+u};d.easing.easeOutQuart=d.easing.easeOutQuart||function(v,w,u,z,y){return -z*((w=w/y-1)*w*w*w-1)+u};d.easing.easeInOutQuart=d.easing.easeInOutQuart||function(v,w,u,z,y){if((w/=y/2)<1){return z/2*w*w*w*w+u}return -z/2*((w-=2)*w*w*w-2)+u};d.easing.easeInQuint=d.easing.easeInQuint||function(v,w,u,z,y){return z*(w/=y)*w*w*w*w+u};d.easing.easeOutQuint=d.easing.easeOutQuint||function(v,w,u,z,y){return z*((w=w/y-1)*w*w*w*w+1)+u};d.easing.easeInOutQuint=d.easing.easeInOutQuint||function(v,w,u,z,y){if((w/=y/2)<1){return z/2*w*w*w*w*w+u}return z/2*((w-=2)*w*w*w*w+2)+u};d.easing.easeInExpo=d.easing.easeInExpo||function(v,w,u,z,y){return(w==0)?u:z*Math.pow(2,10*(w/y-1))+u};d.easing.easeOutExpo=d.easing.easeOutExpo||function(v,w,u,z,y){return(w==y)?u+z:z*(-Math.pow(2,-10*w/y)+1)+u};d.easing.easeInOutExpo=d.easing.easeInOutExpo||function(v,w,u,z,y){if(w==0){return u}if(w==y){return u+z}if((w/=y/2)<1){return z/2*Math.pow(2,10*(w-1))+u}return z/2*(-Math.pow(2,-10*--w)+2)+u};d.easing.easeInSine=d.easing.easeInSine||function(v,w,u,z,y){return -z*Math.cos(w/y*(Math.PI/2))+z+u};d.easing.easeOutSine=d.easing.easeOutSine||function(v,w,u,z,y){return z*Math.sin(w/y*(Math.PI/2))+u};d.easing.easeInOutSine=d.easing.easeInOutSine||function(v,w,u,z,y){return -z/2*(Math.cos(Math.PI*w/y)-1)+u};d.easing.easeInCirc=d.easing.easeInCirc||function(v,w,u,z,y){return -z*(Math.sqrt(1-(w/=y)*w)-1)+u};d.easing.easeOutCirc=d.easing.easeOutCirc||function(v,w,u,z,y){return z*Math.sqrt(1-(w=w/y-1)*w)+u};d.easing.easeInOutCirc=d.easing.easeInOutCirc||function(v,w,u,z,y){if((w/=y/2)<1){return -z/2*(Math.sqrt(1-w*w)-1)+u}return z/2*(Math.sqrt(1-(w-=2)*w)+1)+u};d.easing.easeInElastic=d.easing.easeInElastic||function(v,y,u,C,B){var z=1.70158;var A=0;var w=C;if(y==0){return u}if((y/=B)==1){return u+C}if(!A){A=B*0.3}if(w<Math.abs(C)){w=C;var z=A/4}else{var z=A/(2*Math.PI)*Math.asin(C/w)}return -(w*Math.pow(2,10*(y-=1))*Math.sin((y*B-z)*(2*Math.PI)/A))+u};d.easing.easeOutElastic=d.easing.easeOutElastic||function(v,y,u,C,B){var z=1.70158;var A=0;var w=C;if(y==0){return u}if((y/=B)==1){return u+C}if(!A){A=B*0.3}if(w<Math.abs(C)){w=C;var z=A/4}else{var z=A/(2*Math.PI)*Math.asin(C/w)}return w*Math.pow(2,-10*y)*Math.sin((y*B-z)*(2*Math.PI)/A)+C+u};d.easing.easeInOutElastic=d.easing.easeInOutElastic||function(v,y,u,C,B){var z=1.70158;var A=0;var w=C;if(y==0){return u}if((y/=B/2)==2){return u+C}if(!A){A=B*(0.3*1.5)}if(w<Math.abs(C)){w=C;var z=A/4}else{var z=A/(2*Math.PI)*Math.asin(C/w)}if(y<1){return -0.5*(w*Math.pow(2,10*(y-=1))*Math.sin((y*B-z)*(2*Math.PI)/A))+u}return w*Math.pow(2,-10*(y-=1))*Math.sin((y*B-z)*(2*Math.PI)/A)*0.5+C+u};d.easing.easeInBack=d.easing.easeInBack||function(v,w,u,A,z,y){if(y==e){y=1.70158}return A*(w/=z)*w*((y+1)*w-y)+u};d.easing.easeOutBack=d.easing.easeOutBack||function(v,w,u,A,z,y){if(y==e){y=1.70158}return A*((w=w/z-1)*w*((y+1)*w+y)+1)+u};d.easing.easeInOutBack=d.easing.easeInOutBack||function(v,w,u,A,z,y){if(y==e){y=1.70158}if((w/=z/2)<1){return A/2*(w*w*(((y*=(1.525))+1)*w-y))+u}return A/2*((w-=2)*w*(((y*=(1.525))+1)*w+y)+2)+u};d.easing.easeInBounce=d.easing.easeInBounce||function(v,w,u,z,y){return z-d.easing.easeOutBounce(v,y-w,0,z,y)+u};d.easing.easeOutBounce=d.easing.easeOutBounce||function(v,w,u,z,y){if((w/=y)<(1/2.75)){return z*(7.5625*w*w)+u}else{if(w<(2/2.75)){return z*(7.5625*(w-=(1.5/2.75))*w+0.75)+u}else{if(w<(2.5/2.75)){return z*(7.5625*(w-=(2.25/2.75))*w+0.9375)+u}else{return z*(7.5625*(w-=(2.625/2.75))*w+0.984375)+u}}}};d.easing.easeInOutBounce=d.easing.easeInOutBounce||function(v,w,u,z,y){if(w<y/2){return d.easing.easeInBounce(v,w*2,0,z,y)*0.5+u}return d.easing.easeOutBounce(v,w*2-y,0,z,y)*0.5+z*0.5+u}}};k._easing.call();d.fn[c]=function(u){if(s[u]){return s[u].apply(this,Array.prototype.slice.call(arguments,1))}else{if(typeof u==="object"||!u){return s.init.apply(this,arguments)}else{d.error("Method "+u+" does not exist")}}};d[c]=function(u){if(s[u]){return s[u].apply(this,Array.prototype.slice.call(arguments,1))}else{if(typeof u==="object"||!u){return s.init.apply(this,arguments)}else{d.error("Method "+u+" does not exist")}}};d[c].defaults=j})(jQuery,window,document);
 
1
+ /* == Page scroll to id == Version: 1.5.2, License: MIT License (MIT) */
2
+ (function(d,h,l,e){var c="mPageScroll2id",i="mPS2id",t=".m_PageScroll2id,a[rel~='m_PageScroll2id'],.page-scroll-to-id,a[rel~='page-scroll-to-id']",j={scrollSpeed:1300,autoScrollSpeed:true,scrollEasing:"easeInOutExpo",scrollingEasing:"easeInOutCirc",pageEndSmoothScroll:true,layout:"vertical",offset:0,highlightSelector:false,clickedClass:i+"-clicked",targetClass:i+"-target",highlightClass:i+"-highlight",forceSingleHighlight:false,keepHighlightUntilNext:false,disablePluginBelow:false,clickEvents:true,onStart:function(){},onComplete:function(){},defaultSelector:false},p,b,g,a,q,f,n,o,m,r,s={init:function(u){var u=d.extend(true,{},j,u);d(l).data(i,u);b=d(l).data(i);p=(!p)?this.selector:p+","+this.selector;if(b.defaultSelector){if(typeof d(p)!=="object"||d(p).length===0){p=t}}if(b.clickEvents){d(l).undelegate("."+i).delegate(p,"click."+i,function(x){if(k._isDisabled.call(null)){k._removeClasses.call(null);return}var w=d(this),v=w.attr("href"),y=w.prop("href");if(v&&v.indexOf("#/")!==-1){return}k._reset.call(null);r=w.data("ps2id-offset")||0;if(k._isValid.call(null,v,y)&&k._findTarget.call(null,v)){x.preventDefault();a="selector";q=w;k._setClasses.call(null,true);k._scrollTo.call(null)}})}d(h).unbind("."+i).bind("scroll."+i+" resize."+i,function(){if(k._isDisabled.call(null)){k._removeClasses.call(null);return}var v=d("._"+i+"-t");v.each(function(x){var w=d(this),z=w.attr("id"),y=k._findHighlight.call(null,z);k._setClasses.call(null,false,w,y);if(x==v.length-1){k._extendClasses.call(null)}})});g=true;k._setup.call(null)},scrollTo:function(w,u){if(k._isDisabled.call(null)){k._removeClasses.call(null);return}if(w&&typeof w!=="undefined"){k._isInit.call(null);var v={layout:b.layout,offset:b.offset,clicked:false},u=d.extend(true,{},v,u);k._reset.call(null);o=u.layout;m=u.offset;w=(w.indexOf("#")!==-1)?w:"#"+w;if(k._isValid.call(null,w)&&k._findTarget.call(null,w)){a="scrollTo";q=u.clicked;if(q){k._setClasses.call(null,true)}k._scrollTo.call(null)}}},destroy:function(){d(h).unbind("."+i);d(l).undelegate("."+i).removeData(i);d("._"+i+"-t").removeData(i);k._removeClasses.call(null,true)}},k={_isDisabled:function(){var v=h,u="inner",w=b.disablePluginBelow instanceof Array?[b.disablePluginBelow[0]||0,b.disablePluginBelow[1]||0]:[b.disablePluginBelow||0,0];if(!("innerWidth" in h)){u="client";v=l.documentElement||l.body}return v[u+"Width"]<=w[0]||v[u+"Height"]<=w[1]},_isValid:function(u,x){if(!u){return}x=(!x)?u:x;var w=(x.indexOf("#/")!==-1)?x.split("#/")[0]:x.split("#")[0],v=h.location.toString().split("#")[0];return u!=="#"&&u.indexOf("#")!==-1&&(w===""||w===v)},_setup:function(){var v=(b.highlightSelector&&b.highlightSelector!=="")?b.highlightSelector:p,u=1;return d(v).each(function(){var z=d(this),w=z.attr("href"),B=z.prop("href");if(k._isValid.call(null,w,B)){var A=(w.indexOf("#/")!==-1)?w.split("#/")[1]:w.split("#")[1],x=d("#"+A);if(x.length>0){if(!x.hasClass("_"+i+"-t")){x.addClass("_"+i+"-t").data(i,{i:u})}if(!z.hasClass("_"+i+"-h")){z.addClass("_"+i+"-h")}var y=k._findHighlight.call(null,A);k._setClasses.call(null,false,x,y);u++;if(u==d(v).length){k._extendClasses.call(null)}}}})},_findTarget:function(w){var v=(w.indexOf("#/")!==-1)?w.split("#/")[1]:w.split("#")[1],u=d("#"+v);if(u.length<1||u.css("position")==="fixed"){if(v==="top"){u=d("body")}else{return}}f=u;if(!o){o=b.layout}m=k._setOffset.call(null);n=[(u.offset().top-m[0]).toString(),(u.offset().left-m[1]).toString()];n[0]=(n[0]<0)?0:n[0];n[1]=(n[1]<0)?0:n[1];return n},_setOffset:function(){if(!m){m=(b.offset)?b.offset:0}if(r){m=r}var w,v,z,u;switch(typeof m){case"object":case"string":w=[(m.y)?m.y:m,(m.x)?m.x:m];v=[(w[0] instanceof jQuery)?w[0]:d(w[0]),(w[1] instanceof jQuery)?w[1]:d(w[1])];if(v[0].length>0){z=v[0].height();if(v[0].css("position")==="fixed"){z+=v[0][0].offsetTop}}else{if(!isNaN(parseFloat(w[0]))&&isFinite(w[0])){z=parseInt(w[0])}else{z=0}}if(v[1].length>0){u=v[1].width();if(v[1].css("position")==="fixed"){u+=v[1][0].offsetLeft}}else{if(!isNaN(parseFloat(w[1]))&&isFinite(w[1])){u=parseInt(w[1])}else{u=0}}break;case"function":w=m.call(null);if(w instanceof Array){z=w[0];u=w[1]}else{z=u=w}break;default:z=u=parseInt(m)}return[z,u]},_findHighlight:function(z){var y=h.location.toString().split("#")[0],v=d("._"+i+"-h[href='#"+z+"']"),w=d("._"+i+"-h[href='"+y+"#"+z+"']"),u=d("._"+i+"-h[href='#/"+z+"']"),x=d("._"+i+"-h[href='"+y+"#/"+z+"']");v=(v.length>0)?v:w;u=(u.length>0)?u:x;return(u.length>0)?u:v},_setClasses:function(z,v,w){var y=b.clickedClass,u=b.targetClass,x=b.highlightClass;if(z&&y&&y!==""){d("."+y).removeClass(y);q.addClass(y)}else{if(v&&u&&u!==""&&w&&x&&x!==""){if(k._currentTarget.call(null,v)){v.addClass(u);w.addClass(x)}else{if(!b.keepHighlightUntilNext||d("."+x).length>1){v.removeClass(u);w.removeClass(x)}}}}},_extendClasses:function(){var u=b.targetClass,z=b.highlightClass,B=d("."+u),y=d("."+z),A=u+"-first",x=u+"-last",w=z+"-first",v=z+"-last";d("._"+i+"-t").removeClass(A+" "+x);d("._"+i+"-h").removeClass(w+" "+v);if(!b.forceSingleHighlight){B.slice(0,1).addClass(A).end().slice(-1).addClass(x);y.slice(0,1).addClass(w).end().slice(-1).addClass(v)}else{if(b.keepHighlightUntilNext&&B.length>1){B.slice(0,1).removeClass(u);y.slice(0,1).removeClass(z)}else{B.slice(1).removeClass(u);y.slice(1).removeClass(z)}}},_removeClasses:function(u){d("."+b.clickedClass).removeClass(b.clickedClass);d("."+b.targetClass).removeClass(b.targetClass+" "+b.targetClass+"-first "+b.targetClass+"-last");d("."+b.highlightClass).removeClass(b.highlightClass+" "+b.highlightClass+"-first "+b.highlightClass+"-last");if(u){d("._"+i+"-t").removeClass("_"+i+"-t");d("._"+i+"-h").removeClass("_"+i+"-h")}},_currentTarget:function(H){var K=b["target_"+H.data(i).i],w=H[0].getBoundingClientRect();if(typeof K!=="undefined"){var F=H.offset().top,G=H.offset().left,L=(K.from)?K.from+F:F,z=(K.to)?K.to+F:F,I=(K.fromX)?K.fromX+G:G,v=(K.toX)?K.toX+G:G;return(w.top>=z&&w.top<=L&&w.left>=v&&w.left<=I)}else{var D=d(h).height(),O=d(h).width(),C=H.height(),N=H.width(),B=1+(C/D),J=B,E=(C<D)?B*(D/C):B,u=1+(N/O),A=u,M=(N<O)?u*(O/N):u;return(w.top<=D/J&&w.bottom>=D/E&&w.left<=O/A&&w.right>=O/M)}},_scrollTo:function(){b.scrollSpeed=parseInt(b.scrollSpeed);n=(b.pageEndSmoothScroll)?k._pageEndSmoothScroll.call(null):n;var v=d("html,body"),x=(b.autoScrollSpeed)?k._autoScrollSpeed.call(null):b.scrollSpeed,z=(v.is(":animated"))?b.scrollingEasing:b.scrollEasing,w=d(h).scrollTop(),u=d(h).scrollLeft();switch(o){case"horizontal":if(u!=n[1]){k._callbacks.call(null,"onStart");v.stop().animate({scrollLeft:n[1]},x,z).promise().then(function(){k._callbacks.call(null,"onComplete")})}break;case"auto":if(w!=n[0]||u!=n[1]){k._callbacks.call(null,"onStart");if(navigator.userAgent.match(/(iPod|iPhone|iPad|Android)/)){var y;v.stop().animate({pageYOffset:n[0],pageXOffset:n[1]},{duration:x,easing:z,step:function(A,B){if(B.prop=="pageXOffset"){y=A}else{if(B.prop=="pageYOffset"){h.scrollTo(y,A)}}}}).promise().then(function(){k._callbacks.call(null,"onComplete")})}else{v.stop().animate({scrollTop:n[0],scrollLeft:n[1]},x,z).promise().then(function(){k._callbacks.call(null,"onComplete")})}}break;default:if(w!=n[0]){k._callbacks.call(null,"onStart");v.stop().animate({scrollTop:n[0]},x,z).promise().then(function(){k._callbacks.call(null,"onComplete")})}}},_pageEndSmoothScroll:function(){var u=d(l).height(),x=d(l).width(),w=d(h).height(),v=d(h).width();return[((u-n[0])<w)?u-w:n[0],((x-n[1])<v)?x-v:n[1]]},_autoScrollSpeed:function(){var w=d(h).scrollTop(),v=d(h).scrollLeft(),x=d(l).height(),u=d(l).width(),y=[b.scrollSpeed+((b.scrollSpeed*(Math.floor((Math.abs(n[0]-w)/x)*100)))/100),b.scrollSpeed+((b.scrollSpeed*(Math.floor((Math.abs(n[1]-v)/u)*100)))/100)];return Math.max.apply(Math,y)},_callbacks:function(u){if(!b){return}this[i]={trigger:a,clicked:q,target:f,scrollTo:{y:n[0],x:n[1]}};switch(u){case"onStart":b.onStart.call(null,this[i]);break;case"onComplete":b.onComplete.call(null,this[i]);break}},_reset:function(){o=m=r=false},_isInit:function(){if(!g){s.init.apply(this)}},_easing:function(){d.easing.easeInQuad=d.easing.easeInQuad||function(v,w,u,z,y){return z*(w/=y)*w+u};d.easing.easeOutQuad=d.easing.easeOutQuad||function(v,w,u,z,y){return -z*(w/=y)*(w-2)+u};d.easing.easeInOutQuad=d.easing.easeInOutQuad||function(v,w,u,z,y){if((w/=y/2)<1){return z/2*w*w+u}return -z/2*((--w)*(w-2)-1)+u};d.easing.easeInCubic=d.easing.easeInCubic||function(v,w,u,z,y){return z*(w/=y)*w*w+u};d.easing.easeOutCubic=d.easing.easeOutCubic||function(v,w,u,z,y){return z*((w=w/y-1)*w*w+1)+u};d.easing.easeInOutCubic=d.easing.easeInOutCubic||function(v,w,u,z,y){if((w/=y/2)<1){return z/2*w*w*w+u}return z/2*((w-=2)*w*w+2)+u};d.easing.easeInQuart=d.easing.easeInQuart||function(v,w,u,z,y){return z*(w/=y)*w*w*w+u};d.easing.easeOutQuart=d.easing.easeOutQuart||function(v,w,u,z,y){return -z*((w=w/y-1)*w*w*w-1)+u};d.easing.easeInOutQuart=d.easing.easeInOutQuart||function(v,w,u,z,y){if((w/=y/2)<1){return z/2*w*w*w*w+u}return -z/2*((w-=2)*w*w*w-2)+u};d.easing.easeInQuint=d.easing.easeInQuint||function(v,w,u,z,y){return z*(w/=y)*w*w*w*w+u};d.easing.easeOutQuint=d.easing.easeOutQuint||function(v,w,u,z,y){return z*((w=w/y-1)*w*w*w*w+1)+u};d.easing.easeInOutQuint=d.easing.easeInOutQuint||function(v,w,u,z,y){if((w/=y/2)<1){return z/2*w*w*w*w*w+u}return z/2*((w-=2)*w*w*w*w+2)+u};d.easing.easeInExpo=d.easing.easeInExpo||function(v,w,u,z,y){return(w==0)?u:z*Math.pow(2,10*(w/y-1))+u};d.easing.easeOutExpo=d.easing.easeOutExpo||function(v,w,u,z,y){return(w==y)?u+z:z*(-Math.pow(2,-10*w/y)+1)+u};d.easing.easeInOutExpo=d.easing.easeInOutExpo||function(v,w,u,z,y){if(w==0){return u}if(w==y){return u+z}if((w/=y/2)<1){return z/2*Math.pow(2,10*(w-1))+u}return z/2*(-Math.pow(2,-10*--w)+2)+u};d.easing.easeInSine=d.easing.easeInSine||function(v,w,u,z,y){return -z*Math.cos(w/y*(Math.PI/2))+z+u};d.easing.easeOutSine=d.easing.easeOutSine||function(v,w,u,z,y){return z*Math.sin(w/y*(Math.PI/2))+u};d.easing.easeInOutSine=d.easing.easeInOutSine||function(v,w,u,z,y){return -z/2*(Math.cos(Math.PI*w/y)-1)+u};d.easing.easeInCirc=d.easing.easeInCirc||function(v,w,u,z,y){return -z*(Math.sqrt(1-(w/=y)*w)-1)+u};d.easing.easeOutCirc=d.easing.easeOutCirc||function(v,w,u,z,y){return z*Math.sqrt(1-(w=w/y-1)*w)+u};d.easing.easeInOutCirc=d.easing.easeInOutCirc||function(v,w,u,z,y){if((w/=y/2)<1){return -z/2*(Math.sqrt(1-w*w)-1)+u}return z/2*(Math.sqrt(1-(w-=2)*w)+1)+u};d.easing.easeInElastic=d.easing.easeInElastic||function(v,y,u,C,B){var z=1.70158;var A=0;var w=C;if(y==0){return u}if((y/=B)==1){return u+C}if(!A){A=B*0.3}if(w<Math.abs(C)){w=C;var z=A/4}else{var z=A/(2*Math.PI)*Math.asin(C/w)}return -(w*Math.pow(2,10*(y-=1))*Math.sin((y*B-z)*(2*Math.PI)/A))+u};d.easing.easeOutElastic=d.easing.easeOutElastic||function(v,y,u,C,B){var z=1.70158;var A=0;var w=C;if(y==0){return u}if((y/=B)==1){return u+C}if(!A){A=B*0.3}if(w<Math.abs(C)){w=C;var z=A/4}else{var z=A/(2*Math.PI)*Math.asin(C/w)}return w*Math.pow(2,-10*y)*Math.sin((y*B-z)*(2*Math.PI)/A)+C+u};d.easing.easeInOutElastic=d.easing.easeInOutElastic||function(v,y,u,C,B){var z=1.70158;var A=0;var w=C;if(y==0){return u}if((y/=B/2)==2){return u+C}if(!A){A=B*(0.3*1.5)}if(w<Math.abs(C)){w=C;var z=A/4}else{var z=A/(2*Math.PI)*Math.asin(C/w)}if(y<1){return -0.5*(w*Math.pow(2,10*(y-=1))*Math.sin((y*B-z)*(2*Math.PI)/A))+u}return w*Math.pow(2,-10*(y-=1))*Math.sin((y*B-z)*(2*Math.PI)/A)*0.5+C+u};d.easing.easeInBack=d.easing.easeInBack||function(v,w,u,A,z,y){if(y==e){y=1.70158}return A*(w/=z)*w*((y+1)*w-y)+u};d.easing.easeOutBack=d.easing.easeOutBack||function(v,w,u,A,z,y){if(y==e){y=1.70158}return A*((w=w/z-1)*w*((y+1)*w+y)+1)+u};d.easing.easeInOutBack=d.easing.easeInOutBack||function(v,w,u,A,z,y){if(y==e){y=1.70158}if((w/=z/2)<1){return A/2*(w*w*(((y*=(1.525))+1)*w-y))+u}return A/2*((w-=2)*w*(((y*=(1.525))+1)*w+y)+2)+u};d.easing.easeInBounce=d.easing.easeInBounce||function(v,w,u,z,y){return z-d.easing.easeOutBounce(v,y-w,0,z,y)+u};d.easing.easeOutBounce=d.easing.easeOutBounce||function(v,w,u,z,y){if((w/=y)<(1/2.75)){return z*(7.5625*w*w)+u}else{if(w<(2/2.75)){return z*(7.5625*(w-=(1.5/2.75))*w+0.75)+u}else{if(w<(2.5/2.75)){return z*(7.5625*(w-=(2.25/2.75))*w+0.9375)+u}else{return z*(7.5625*(w-=(2.625/2.75))*w+0.984375)+u}}}};d.easing.easeInOutBounce=d.easing.easeInOutBounce||function(v,w,u,z,y){if(w<y/2){return d.easing.easeInBounce(v,w*2,0,z,y)*0.5+u}return d.easing.easeOutBounce(v,w*2-y,0,z,y)*0.5+z*0.5+u}}};k._easing.call();d.fn[c]=function(u){if(s[u]){return s[u].apply(this,Array.prototype.slice.call(arguments,1))}else{if(typeof u==="object"||!u){return s.init.apply(this,arguments)}else{d.error("Method "+u+" does not exist")}}};d[c]=function(u){if(s[u]){return s[u].apply(this,Array.prototype.slice.call(arguments,1))}else{if(typeof u==="object"||!u){return s.init.apply(this,arguments)}else{d.error("Method "+u+" does not exist")}}};d[c].defaults=j})(jQuery,window,document);
malihu-pagescroll2id.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: Page scroll to id
4
  Plugin URI: http://manos.malihu.gr/page-scroll-to-id
5
  Description: Page scroll to id is an easy-to-use jQuery plugin that enables animated page scrolling to specific id within the document.
6
- Version: 1.5.5
7
  Author: malihu
8
  Author URI: http://manos.malihu.gr
9
  License: MIT License (MIT)
@@ -45,7 +45,7 @@ if(!class_exists('malihuPageScroll2id')){ // --edit--
45
 
46
  class malihuPageScroll2id{ // --edit--
47
 
48
- protected $version='1.5.5'; // Plugin version --edit--
49
  protected $update_option=null;
50
 
51
  protected $plugin_name='Page scroll to id'; // Plugin name --edit--
@@ -495,7 +495,9 @@ if(!class_exists('malihuPageScroll2id')){ // --edit--
495
  $d10='mPS2id-target';
496
  $d11='mPS2id-highlight';
497
  $d12='false';
 
498
  $d13='false';
 
499
  // Values
500
  switch($action){
501
  case 'validate':
@@ -512,7 +514,9 @@ if(!class_exists('malihuPageScroll2id')){ // --edit--
512
  $v10=$this->sanitize_input('class', $_POST[$this->db_prefix.$i.'_targetClass'], $d10);
513
  $v11=$this->sanitize_input('class', $_POST[$this->db_prefix.$i.'_highlightClass'], $d11);
514
  $v12=(isset($_POST[$this->db_prefix.$i.'_forceSingleHighlight'])) ? 'true' : 'false';
 
515
  $v13=(isset($_POST[$this->db_prefix.$i.'_scrollToHash'])) ? 'true' : 'false';
 
516
  break;
517
  case 'upgrade':
518
  if(isset($old)){
@@ -538,7 +542,9 @@ if(!class_exists('malihuPageScroll2id')){ // --edit--
538
  $v10=(isset($j['targetClass'])) ? $j['targetClass']['value'] : $d10;
539
  $v11=(isset($j['highlightClass'])) ? $j['highlightClass']['value'] : $d11;
540
  $v12=(isset($j['forceSingleHighlight'])) ? $j['forceSingleHighlight']['value'] : $d12;
 
541
  $v13=(isset($j['scrollToHash'])) ? $j['scrollToHash']['value'] : $d13;
 
542
  break;
543
  default:
544
  $v0=$d0;
@@ -554,7 +560,9 @@ if(!class_exists('malihuPageScroll2id')){ // --edit--
554
  $v10=$d10;
555
  $v11=$d11;
556
  $v12=$d12;
 
557
  $v13=$d13;
 
558
  }
559
  // Options array
560
  /*
@@ -700,7 +708,7 @@ if(!class_exists('malihuPageScroll2id')){ // --edit--
700
  'checkbox_label' => null,
701
  'radio_labels' => null,
702
  'field_info' => 'class name',
703
- 'description' => 'Class of the (current) target element',
704
  'wrapper' => null
705
  ),
706
  'highlightClass' => array(
@@ -712,7 +720,7 @@ if(!class_exists('malihuPageScroll2id')){ // --edit--
712
  'checkbox_label' => null,
713
  'radio_labels' => null,
714
  'field_info' => 'class name',
715
- 'description' => 'Class of the (current) highlighted element',
716
  'wrapper' => null
717
  ),
718
  'forceSingleHighlight' => array(
@@ -727,6 +735,18 @@ if(!class_exists('malihuPageScroll2id')){ // --edit--
727
  'description' => 'Allow only one highlighted element at a time',
728
  'wrapper' => 'fieldset'
729
  ),
 
 
 
 
 
 
 
 
 
 
 
 
730
  'scrollToHash' => array(
731
  'value' => $v13,
732
  'values' => null,
@@ -738,6 +758,18 @@ if(!class_exists('malihuPageScroll2id')){ // --edit--
738
  'field_info' => null,
739
  'description' => 'Scroll to target id (e.g. <code>&lt;div id="id" /&gt;</code>) based on location hash (e.g. <code>mysite.com/mypage#id</code>) on page load',
740
  'wrapper' => 'fieldset'
 
 
 
 
 
 
 
 
 
 
 
 
741
  )
742
  );
743
  }
3
  Plugin Name: Page scroll to id
4
  Plugin URI: http://manos.malihu.gr/page-scroll-to-id
5
  Description: Page scroll to id is an easy-to-use jQuery plugin that enables animated page scrolling to specific id within the document.
6
+ Version: 1.5.6
7
  Author: malihu
8
  Author URI: http://manos.malihu.gr
9
  License: MIT License (MIT)
45
 
46
  class malihuPageScroll2id{ // --edit--
47
 
48
+ protected $version='1.5.6'; // Plugin version --edit--
49
  protected $update_option=null;
50
 
51
  protected $plugin_name='Page scroll to id'; // Plugin name --edit--
495
  $d10='mPS2id-target';
496
  $d11='mPS2id-highlight';
497
  $d12='false';
498
+ $d14='false';
499
  $d13='false';
500
+ $d15=0;
501
  // Values
502
  switch($action){
503
  case 'validate':
514
  $v10=$this->sanitize_input('class', $_POST[$this->db_prefix.$i.'_targetClass'], $d10);
515
  $v11=$this->sanitize_input('class', $_POST[$this->db_prefix.$i.'_highlightClass'], $d11);
516
  $v12=(isset($_POST[$this->db_prefix.$i.'_forceSingleHighlight'])) ? 'true' : 'false';
517
+ $v14=(isset($_POST[$this->db_prefix.$i.'_keepHighlightUntilNext'])) ? 'true' : 'false';
518
  $v13=(isset($_POST[$this->db_prefix.$i.'_scrollToHash'])) ? 'true' : 'false';
519
+ $v15=$this->sanitize_input('text', $_POST[$this->db_prefix.$i.'_disablePluginBelow'], $d15);
520
  break;
521
  case 'upgrade':
522
  if(isset($old)){
542
  $v10=(isset($j['targetClass'])) ? $j['targetClass']['value'] : $d10;
543
  $v11=(isset($j['highlightClass'])) ? $j['highlightClass']['value'] : $d11;
544
  $v12=(isset($j['forceSingleHighlight'])) ? $j['forceSingleHighlight']['value'] : $d12;
545
+ $v14=(isset($j['keepHighlightUntilNext'])) ? $j['keepHighlightUntilNext']['value'] : $d14;
546
  $v13=(isset($j['scrollToHash'])) ? $j['scrollToHash']['value'] : $d13;
547
+ $v15=(isset($j['disablePluginBelow'])) ? $j['disablePluginBelow']['value'] : $d15;
548
  break;
549
  default:
550
  $v0=$d0;
560
  $v10=$d10;
561
  $v11=$d11;
562
  $v12=$d12;
563
+ $v14=$d14;
564
  $v13=$d13;
565
+ $v15=$d15;
566
  }
567
  // Options array
568
  /*
708
  'checkbox_label' => null,
709
  'radio_labels' => null,
710
  'field_info' => 'class name',
711
+ 'description' => 'Class of the (current) target element. First (current) target element class suffix: <code>-first</code> (e.g. <code>.mPS2id-target-first</code>). Last (current) target element class suffix: <code>-last</code> (e.g. <code>.mPS2id-target-last</code>)',
712
  'wrapper' => null
713
  ),
714
  'highlightClass' => array(
720
  'checkbox_label' => null,
721
  'radio_labels' => null,
722
  'field_info' => 'class name',
723
+ 'description' => 'Class of the (current) highlighted element. First (current) highlighted element class suffix: <code>-first</code> (e.g. <code>.mPS2id-highlight-first</code>). Last (current) highlighted element class suffix: <code>-last</code> (e.g. <code>.mPS2id-highlight-last</code>)',
724
  'wrapper' => null
725
  ),
726
  'forceSingleHighlight' => array(
735
  'description' => 'Allow only one highlighted element at a time',
736
  'wrapper' => 'fieldset'
737
  ),
738
+ 'keepHighlightUntilNext' => array(
739
+ 'value' => $v14,
740
+ 'values' => null,
741
+ 'id' => $this->db_prefix.$i.'_keepHighlightUntilNext',
742
+ 'field_type' => 'checkbox',
743
+ 'label' => '',
744
+ 'checkbox_label' => 'Keep highlight until next',
745
+ 'radio_labels' => null,
746
+ 'field_info' => null,
747
+ 'description' => 'Keep the current element highlighted until the next one comes into view',
748
+ 'wrapper' => 'fieldset'
749
+ ),
750
  'scrollToHash' => array(
751
  'value' => $v13,
752
  'values' => null,
758
  'field_info' => null,
759
  'description' => 'Scroll to target id (e.g. <code>&lt;div id="id" /&gt;</code>) based on location hash (e.g. <code>mysite.com/mypage#id</code>) on page load',
760
  'wrapper' => 'fieldset'
761
+ ),
762
+ 'disablePluginBelow' => array(
763
+ 'value' => $v15,
764
+ 'values' => null,
765
+ 'id' => $this->db_prefix.$i.'_disablePluginBelow',
766
+ 'field_type' => 'text',
767
+ 'label' => 'Disable plugin below',
768
+ 'checkbox_label' => null,
769
+ 'radio_labels' => null,
770
+ 'field_info' => 'screen-size',
771
+ 'description' => 'Set the width,height screen-size (in pixels), below which the plugin will be disabled (e.g. <code>1024</code>, <code>1024,600</code>)',
772
+ 'wrapper' => null
773
  )
774
  );
775
  }
readme.txt CHANGED
@@ -3,8 +3,8 @@ Contributors: malihu
3
  Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=UYJ5G65M6ZA28
4
  Tags: page scrolling, page animation, navigation, single-page navigation
5
  Requires at least: 3.3
6
- Tested up to: 3.9
7
- Stable tag: 1.5.5
8
  License: The MIT License (MIT)
9
  License URI: http://opensource.org/licenses/MIT
10
 
@@ -34,9 +34,9 @@ Page scroll to id requires WordPress version **3.3** or higher and jQuery versio
34
  = Quick usage =
35
 
36
  1. [Install the plugin](http://wordpress.org/plugins/page-scroll-to-id/installation/).
37
- 2. Add `rel="m_PageScroll2id"` to your links that point to existing sections within your page, making sure each link's href value contains a hash (`#`) with the id of the section you want to scroll-to.
38
 
39
- For more information see plugin resources below.
40
 
41
  = Plugin Resources =
42
 
@@ -66,7 +66,7 @@ Configure plugin options by clicking 'Settings' or through the 'Settings > Page
66
 
67
  = How to use the plugin with WP custom/native menus? =
68
 
69
- While on the 'Menus' admin page, click 'Screen Options' and check 'Link Relationship (XFN)'. To enable the plugin on a menu item, click the arrow on the right of the item and insert `m_PageScroll2id` in the 'Link Relationship (XFN)' field (assuming your menu contains links with `URL` value in the form of `#id`).
70
 
71
  = How to use the plugin without editing my theme's markup? =
72
 
@@ -80,6 +80,14 @@ You can add the `m_PageScroll2id` in your link's rel attribute (along with the o
80
 
81
  The plugin provides a ready-to-use class for styling highlighted links (the links whose target element is considered to be within the viewport). The default highlight class is `mPS2id-highlight`, so you can use it in your theme's CSS to style current menu items, e.g. `.menu-item a.mPS2id-highlight{ background: #ff0; }`.
82
 
 
 
 
 
 
 
 
 
83
  = When I click the link, nothing happens... =
84
 
85
  Make sure your link has href value `#` with the id of the section you want to scroll-to (e.g. `<a href="#id" rel="m_PageScroll2id">link</a>`) and a section with such an id exists in your page (e.g. `<div id="id">target</div>`).
@@ -108,6 +116,10 @@ Yes, by inserting comma separated values in `Offset` field For example `100,50`
108
 
109
  Yes, by adding the html attribute `data-ps2id-offset` to a link. For example, `<a href="#id" rel="m_PageScroll2id" data-ps2id-offset="100">link</a>` will offset scroll-to position by 100 pixels. You may also use the `ps2id` shortcode to create links with specific offsets, e.g. `[ps2id url='#id' offset='100']link[/ps2id]`.
110
 
 
 
 
 
111
  = Can I use the plugin to scroll an overflowed div? =
112
 
113
  No. The plugin scrolls the entire page (the document's root element) so it works correctly highlighting links, alongside deep linking plugins etc. with mouse and touch events.
@@ -128,6 +140,12 @@ Yes but you probably need to implement the plugin in your theme **manually**. Se
128
 
129
  == Changelog ==
130
 
 
 
 
 
 
 
131
  = 1.5.5 =
132
  * Fixed contextual help links in plugin settings page.
133
  * Updated Offset field to accept comma separated values for defining different offsets for vertical and horizontal layout (e.g. `100,50`).
@@ -180,6 +198,10 @@ Yes but you probably need to implement the plugin in your theme **manually**. Se
180
 
181
  == Upgrade Notice ==
182
 
 
 
 
 
183
  = 1.5.5 =
184
 
185
  Fixed contextual help links in plugin settings, define different offsets for vertical and horizontal layout, Added 'Scroll to location hash' option, updated readme.txt.
3
  Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=UYJ5G65M6ZA28
4
  Tags: page scrolling, page animation, navigation, single-page navigation
5
  Requires at least: 3.3
6
+ Tested up to: 4.0
7
+ Stable tag: 1.5.6
8
  License: The MIT License (MIT)
9
  License URI: http://opensource.org/licenses/MIT
10
 
34
  = Quick usage =
35
 
36
  1. [Install the plugin](http://wordpress.org/plugins/page-scroll-to-id/installation/).
37
+ 2. Add `rel="m_PageScroll2id"` to your links that point to existing sections within your page, making sure each link's href value contains a hash (`#`) with the id of the section you want to scroll-to. To enable the rel attribute field in WordPress Menus, click 'Screen Options' and check 'Link Relationship (XFN)'. To enable the plugin on a menu item, click the arrow on the right of the item and insert `m_PageScroll2id` in the 'Link Relationship (XFN)' field.
38
 
39
+ For more information see Help in plugin settings and resources below.
40
 
41
  = Plugin Resources =
42
 
66
 
67
  = How to use the plugin with WP custom/native menus? =
68
 
69
+ While on the 'Menus' admin page, click 'Screen Options' and check 'Link Relationship (XFN)'. To enable the plugin on a menu item (added to menu via 'Custom Links' panel), click the arrow on the right of the item and insert `m_PageScroll2id` in the 'Link Relationship (XFN)' field (assuming your menu contains links with `URL` value in the form of `#id`).
70
 
71
  = How to use the plugin without editing my theme's markup? =
72
 
80
 
81
  The plugin provides a ready-to-use class for styling highlighted links (the links whose target element is considered to be within the viewport). The default highlight class is `mPS2id-highlight`, so you can use it in your theme's CSS to style current menu items, e.g. `.menu-item a.mPS2id-highlight{ background: #ff0; }`.
82
 
83
+ = More than one links are highlighted! How to highlight only the first one? =
84
+
85
+ Use the `mPS2id-highlight-first` class in your stylesheet (instead of just `mPS2id-highlight`). This class is added by the script on the first link whose target element is considered to be within the viewport, e.g. `.menu-item a.mPS2id-highlight-first{ background: #ff0; }`. Alternatively, enable 'Force single highlight' option in plugin settings.
86
+
87
+ = How to keep my links highlighted when my target elements have 0 height? =
88
+
89
+ Enable 'Keep highlight until next' option in plugin settings, which keeps the current highlighted element on until the next one comes into view.
90
+
91
  = When I click the link, nothing happens... =
92
 
93
  Make sure your link has href value `#` with the id of the section you want to scroll-to (e.g. `<a href="#id" rel="m_PageScroll2id">link</a>`) and a section with such an id exists in your page (e.g. `<div id="id">target</div>`).
116
 
117
  Yes, by adding the html attribute `data-ps2id-offset` to a link. For example, `<a href="#id" rel="m_PageScroll2id" data-ps2id-offset="100">link</a>` will offset scroll-to position by 100 pixels. You may also use the `ps2id` shortcode to create links with specific offsets, e.g. `[ps2id url='#id' offset='100']link[/ps2id]`.
118
 
119
+ = How do I disable the plugin on small screens? =
120
+
121
+ Use the 'Disable plugin below screen-size' option in plugin settings. You can set a minimum width,height value required in order to enable plugin functionality.
122
+
123
  = Can I use the plugin to scroll an overflowed div? =
124
 
125
  No. The plugin scrolls the entire page (the document's root element) so it works correctly highlighting links, alongside deep linking plugins etc. with mouse and touch events.
140
 
141
  == Changelog ==
142
 
143
+ = 1.5.6 =
144
+ * Changed the way 'Force single highlight' option works. When enabled, it now highlights the first highlighted element instead of last.
145
+ * Extended highlight and target classes with additional ones in order to differentiate the first and last elements. You can now use `.mPS2id-highlight-first`, `.mPS2id-highlight-last`, `.mPS2id-target-first` and `.mPS2id-target-last` in order to target the first and last highlighted links and targets in your CSS.
146
+ * Added 'Keep highlight until next' option. When enabled, the plugin will keep the current link/target highlighted until the next one comes into view (one element always stays highlighted).
147
+ * Added 'Disable plugin below screen-size' option. Set the screen-size (in pixels), below which the plugin will be disabled.
148
+
149
  = 1.5.5 =
150
  * Fixed contextual help links in plugin settings page.
151
  * Updated Offset field to accept comma separated values for defining different offsets for vertical and horizontal layout (e.g. `100,50`).
198
 
199
  == Upgrade Notice ==
200
 
201
+ = 1.5.6 =
202
+
203
+ 'Force single highlight' option will now highlight the first element instead of last, Extended highlight and target classes with additional ones, Added 'Keep highlight until next' and 'Disable plugin below screen-size' options, extended help, updated readme.txt.
204
+
205
  = 1.5.5 =
206
 
207
  Fixed contextual help links in plugin settings, define different offsets for vertical and horizontal layout, Added 'Scroll to location hash' option, updated readme.txt.
screenshot-1.png CHANGED
Binary file
screenshot-2.png CHANGED
Binary file