From dc69541c86b20a0e43a10fd610194a2b1326ab40 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81lvaro?= Date: Tue, 24 Mar 2015 16:28:13 +0000 Subject: [PATCH] - Added new feature to create an scrollable section by using `pp-scrollable`. --- bower.json | 4 ++-- jquery.pagepiling.css | 6 +++++- jquery.pagepiling.js | 15 +++++++++++++-- jquery.pagepiling.min.js | 30 +++++++++++++++--------------- 4 files changed, 35 insertions(+), 20 deletions(-) diff --git a/bower.json b/bower.json index f7b3255..83bed32 100644 --- a/bower.json +++ b/bower.json @@ -1,6 +1,6 @@ { "name": "pagePiling.js", - "version": "1.3", + "version": "1.4", "homepage": "https://github.com/alvarotrigo/pagePiling.js", "authors": [ "Alvaro Trigo https://github.com/alvarotrigo" @@ -33,6 +33,6 @@ "examples" ], "dependencies": { - "jquery": "1.11.1" + "jquery": ">=1.7.0" } } diff --git a/jquery.pagepiling.css b/jquery.pagepiling.css index 77fa349..82400d8 100644 --- a/jquery.pagepiling.css +++ b/jquery.pagepiling.css @@ -1,5 +1,5 @@ /* =========================================================== - * pagepiling.js 0.0.1 (Beta) + * pagepiling.js 1.4 * * https://github.com/alvarotrigo/fullPage.js * MIT licensed @@ -123,3 +123,7 @@ html, body { .pp-tooltip.left { left: 20px; } +.pp-scrollable{ + overflow-y: scroll; + height: 100%; +} \ No newline at end of file diff --git a/jquery.pagepiling.js b/jquery.pagepiling.js index b9b9fe9..80a7352 100644 --- a/jquery.pagepiling.js +++ b/jquery.pagepiling.js @@ -1,5 +1,5 @@ /* =========================================================== - * pagepiling.js 1.3 + * pagepiling.js 1.4 * * https://github.com/alvarotrigo/pagePiling.js * MIT licensed @@ -207,7 +207,6 @@ $.isFunction( options.afterRender ) && options.afterRender.call( this); }); - /** * Enables vertical centering by wrapping the content and the use of table and table-cell */ @@ -614,6 +613,18 @@ } } + /** + * Return a boolean depending on whether the scrollable element is at the end or at the start of the scrolling + * depending on the given type. + */ + function isScrolled(type, scrollable){ + if(type === 'top'){ + return !scrollable.scrollTop(); + }else if(type === 'bottom'){ + return scrollable.scrollTop() + 1 + scrollable.innerHeight() >= scrollable[0].scrollHeight; + } + } + /** * Determines whether the active section or slide is scrollable through and scrolling bar */ diff --git a/jquery.pagepiling.min.js b/jquery.pagepiling.min.js index abefaf7..dc10837 100644 --- a/jquery.pagepiling.min.js +++ b/jquery.pagepiling.min.js @@ -1,5 +1,5 @@ /* =========================================================== - * pagepiling.js 1.3 + * pagepiling.js 1.4 * * https://github.com/alvarotrigo/pagePiling.js * MIT licensed @@ -12,17 +12,17 @@ I(c.anchorLink,c.sectionIndex),c.destination.addClass("active").siblings().remov b.isFunction(options.onLeave)&&options.onLeave.call(this,c.leavingSection,c.sectionIndex+1,c.yMovement),K(c),L(c.anchorLink),M(c.anchorLink,c.sectionIndex),v=c.anchorLink,w=(new Date).getTime())}function K(a){options.css3?(x(a.animateSection,a.translate3d,a.animated),a.sectionsToMove.each(function(){x(b(this),a.translate3d,a.animated)}),setTimeout(function(){q(a)},options.scrollingSpeed)):(a.scrollOptions=p(a.scrolling),a.animated?a.animateSection.animate(a.scrollOptions,options.scrollingSpeed,options.easing, function(){y(a);q(a)}):(a.animateSection.css(p(a.scrolling)),setTimeout(function(){y(a);q(a)},400)))}function q(a){b.isFunction(options.afterLoad)&&options.afterLoad.call(this,a.anchorLink,a.sectionIndex+1)}function J(a){return"down"===a.yMovement?b(".pp-section").map(function(d){if(da.destination.index(".pp-section"))return b(this)})}function y(a){"up"===a.yMovement&&a.sectionsToMove.each(function(d){b(this).css(p(a.scrolling))})} function p(a){return"vertical"===options.direction?{top:a}:{left:a}}function I(a,b){options.anchors.length?(location.hash=a,z(location.hash)):z(String(b))}function z(a){a=a.replace("#","");b("body")[0].className=b("body")[0].className.replace(/\b\s?pp-viewing-[^\s]+\b/g,"");b("body").addClass("pp-viewing-"+a)}function r(){return(new Date).getTime()-w<600+options.scrollingSpeed?!0:!1}function x(a,b,c){a.toggleClass("pp-easing",c);a.css({"-webkit-transform":b,"-moz-transform":b,"-ms-transform":b,transform:b})} -function l(a){if(!r()){a=h.event||a;a=Math.max(-1,Math.min(1,a.wheelDelta||-a.deltaY||-a.detail));var d=b(".pp-section.active"),d=A(d);0>a?m("down",d):m("up",d);return!1}}function m(a,b){if("down"==a)var c="bottom",f=e.moveSectionDown;else c="top",f=e.moveSectionUp;if(0Math.abs(n-touchEndY)?Math.abs(touchStartX-touchEndX)>f.width()/100*options.touchSensitivity&&(touchStartX>touchEndX?m("down",a):touchEndX>touchStartX&&m("up",a)):Math.abs(n-touchEndY)>f.height()/100*options.touchSensitivity&&(n>touchEndY?m("down",a):touchEndY>n&&m("up",a))))}function E(a,d){d=d||0;var c=b(a).parent();return d
    ');var a=b("#pp-nav");a.css("color",options.navigation.textColor);a.addClass(options.navigation.position);for(var d=0;d')}a.find("span").css("border-color", -options.navigation.bulletsColor)}function M(a,d){options.navigation&&(b("#pp-nav").find(".active").removeClass("active"),a?b("#pp-nav").find('a[href="#'+a+'"]').addClass("active"):b("#pp-nav").find("li").eq(d).find("a").addClass("active"))}function L(a){options.menu&&(b(options.menu).find(".active").removeClass("active"),b(options.menu).find('[data-menuanchor="'+a+'"]').addClass("active"))}function Q(){var a=g.createElement("p"),b,c={webkitTransform:"-webkit-transform",OTransform:"-o-transform",msTransform:"-ms-transform", -MozTransform:"-moz-transform",transform:"transform"};g.body.insertBefore(a,null);for(var e in c)a.style[e]!==u&&(a.style[e]="translate3d(1px,1px,1px)",b=h.getComputedStyle(a).getPropertyValue(c[e]));g.body.removeChild(a);return b!==u&&0');--t}).promise().done(function(){options.navigation&&(b("#pp-nav").css("margin-top","-"+b("#pp-nav").height()/2+"px"),b("#pp-nav").find("li").eq(b(".pp-section.active").index(".pp-section")).find("a").addClass("active")); -b(h).on("load",function(){var a=h.location.hash.replace("#",""),a=b('.pp-section[data-anchor="'+a+'"]');0'+a+"").hide().appendTo(b(this)).fadeIn(200)},mouseleave:function(){b(this).find(".pp-tooltip").fadeOut(200,function(){b(this).remove()})}},"#pp-nav li")}})(jQuery,document,window); \ No newline at end of file +function l(a){if(!r()){a=h.event||a;a=Math.max(-1,Math.min(1,a.wheelDelta||-a.deltaY||-a.detail));var d=b(".pp-section.active"),d=A(d);0>a?m("down",d):m("up",d);return!1}}function m(a,b){if("down"==a)var c="bottom",f=e.moveSectionDown;else c="top",f=e.moveSectionUp;if(0=b[0].scrollHeight:void 0,c)f();else return!0;else f()}function A(a){return scrollable=a.find(".pp-scrollable")}function B(){return h.PointerEvent? +{down:"pointerdown",move:"pointermove",up:"pointerup"}:{down:"MSPointerDown",move:"MSPointerMove",up:"MSPointerUp"}}function C(a){var b=[];b.y="undefined"!==typeof a.pageY&&(a.pageY||a.pageX)?a.pageY:a.touches[0].pageY;b.x="undefined"!==typeof a.pageX&&(a.pageY||a.pageX)?a.pageX:a.touches[0].pageX;return b}function D(a){return"undefined"===typeof a.pointerType||"mouse"!=a.pointerType}function N(a){a=a.originalEvent;D(a)&&(a=C(a),n=a.y,touchStartX=a.x)}function O(a){var d=a.originalEvent;!E(a.target)&& +D(d)&&(a.preventDefault(),a=b(".pp-section.active"),a=A(a),r()||(d=C(d),touchEndY=d.y,touchEndX=d.x,"horizontal"===options.direction&&Math.abs(touchStartX-touchEndX)>Math.abs(n-touchEndY)?Math.abs(touchStartX-touchEndX)>f.width()/100*options.touchSensitivity&&(touchStartX>touchEndX?m("down",a):touchEndX>touchStartX&&m("up",a)):Math.abs(n-touchEndY)>f.height()/100*options.touchSensitivity&&(n>touchEndY?m("down",a):touchEndY>n&&m("up",a))))}function E(a,d){d=d||0;var c=b(a).parent();return d
      ');var a=b("#pp-nav");a.css("color",options.navigation.textColor);a.addClass(options.navigation.position);for(var d=0;d')}a.find("span").css("border-color",options.navigation.bulletsColor)}function M(a,d){options.navigation&&(b("#pp-nav").find(".active").removeClass("active"),a?b("#pp-nav").find('a[href="#'+a+'"]').addClass("active"):b("#pp-nav").find("li").eq(d).find("a").addClass("active"))}function L(a){options.menu&&(b(options.menu).find(".active").removeClass("active"),b(options.menu).find('[data-menuanchor="'+a+'"]').addClass("active"))}function Q(){var a=g.createElement("p"), +b,c={webkitTransform:"-webkit-transform",OTransform:"-o-transform",msTransform:"-ms-transform",MozTransform:"-moz-transform",transform:"transform"};g.body.insertBefore(a,null);for(var e in c)a.style[e]!==u&&(a.style[e]="translate3d(1px,1px,1px)",b=h.getComputedStyle(a).getPropertyValue(c[e]));g.body.removeChild(a);return b!==u&&0');--t}).promise().done(function(){options.navigation&& +(b("#pp-nav").css("margin-top","-"+b("#pp-nav").height()/2+"px"),b("#pp-nav").find("li").eq(b(".pp-section.active").index(".pp-section")).find("a").addClass("active"));b(h).on("load",function(){var a=h.location.hash.replace("#",""),a=b('.pp-section[data-anchor="'+a+'"]');0'+a+"").hide().appendTo(b(this)).fadeIn(200)},mouseleave:function(){b(this).find(".pp-tooltip").fadeOut(200,function(){b(this).remove()})}},"#pp-nav li")}})(jQuery,document,window); \ No newline at end of file