From cf4617d9e7278947b7dfb21f48a0724a96e39f8f Mon Sep 17 00:00:00 2001 From: "vincent@cubedesigners.com" Date: Wed, 31 Aug 2016 09:08:52 +0000 Subject: [PATCH] --- js/209-scrollify.js | 7 +++---- js/210-home.js | 29 ++++++++++++++++++++++------- 2 files changed, 25 insertions(+), 11 deletions(-) diff --git a/js/209-scrollify.js b/js/209-scrollify.js index 3bba26f..748ad38 100644 --- a/js/209-scrollify.js +++ b/js/209-scrollify.js @@ -122,9 +122,9 @@ } if (names[index]) { scrollable = false; - if (callbacks) { - settings.before(index, elements); - } + + settings.before(index, elements); + interstitialIndex = 1; //### DISABLED hash updates to URL @@ -167,7 +167,6 @@ scrollTop: heights[index] }, settings.scrollSpeed, settings.easing, function () { $(window).scrollTop(heights[index]); - console.log(heights[index]); }); } diff --git a/js/210-home.js b/js/210-home.js index a44297b..affb760 100644 --- a/js/210-home.js +++ b/js/210-home.js @@ -1,9 +1,12 @@ +var lastDotIndex; + registerLoader(load_home, true); function load_home() { $(window).on('fluidbookresize', resizeHome); resizeHome(); initScrollify(); + // Bouncing scroll down arrow // Show scroll-down arrow after a small delay setTimeout(function () { @@ -22,6 +25,7 @@ function load_home() { // Handle clicks on pagination dots $(".pagination li").on("click", function () { $.scrollify.move($(this).data('section')); + return false; }); // Disable scrollify when popups are open because it @@ -122,6 +126,7 @@ function initScrollify() { interstitialSection: '.auto-height', setHeights: false, before: function (index, sections) { + lastDotIndex = index; //fb("before: #" + index, sections.length); // Handle scrolling to last (footer) section @@ -149,26 +154,36 @@ function initScrollify() { }, 300); } + // Pagination update + var ref = sections[lastDotIndex].attr('data-section-name'); + $(".pagination .active").removeClass('active'); + $(".pagination").find('[data-section="#' + ref + '"]').addClass('active'); + }, + after: function (index, sections) { + if (index !== lastDotIndex) { + return; + } // Pagination update - var ref = sections[index].attr('data-section-name'); - var color = sections[index].attr('data-themecolor'); - $(".pagination .active").css('color', '').removeClass('active'); - $(".pagination").find('[data-section="#' + ref + '"]').css('color', color).addClass('active'); + var ref = sections[lastDotIndex].attr('data-section-name'); + $(".pagination .active").removeClass('active'); + $(".pagination").find('[data-section="#' + ref + '"]').addClass('active'); }, afterRender: function () { var pagination = '"; + pagination = '' + pagination; $('body').append(pagination); - - // Highlight first dot - $('.pagination li:first-of-type').css('color', $('[data-section-name]:first-of-type').data('themecolor')).addClass('active'); } }); } -- 2.39.5