]> _ Git - fluidbook-v3.git/commitdiff
(no commit message)
authorvincent@cubedesigners.com <vincent@cubedesigners.com@f5622870-0f3c-0410-866d-9cb505b7a8ef>
Wed, 31 Aug 2016 09:08:52 +0000 (09:08 +0000)
committervincent@cubedesigners.com <vincent@cubedesigners.com@f5622870-0f3c-0410-866d-9cb505b7a8ef>
Wed, 31 Aug 2016 09:08:52 +0000 (09:08 +0000)
js/209-scrollify.js
js/210-home.js

index 3bba26fea8c164a8288657f9d9ab8812e808df82..748ad3817a1d794a2d6c085426bbd23433cdefc6 100644 (file)
         }
         if (names[index]) {
             scrollable = false;
-            if (callbacks) {
-                settings.before(index, elements);
-            }
+
+            settings.before(index, elements);
+
             interstitialIndex = 1;
 
             //### DISABLED hash updates to URL
                         scrollTop: heights[index]
                     }, settings.scrollSpeed, settings.easing, function () {
                         $(window).scrollTop(heights[index]);
-                        console.log(heights[index]);
                     });
                 }
 
index a44297b3ff72e912a1e4fcce696a0c0e49843cca..affb760a05f95d23204b71a8ec20142d31abe769 100644 (file)
@@ -1,9 +1,12 @@
+var lastDotIndex;\r
+\r
 registerLoader(load_home, true);\r
 function load_home() {\r
     $(window).on('fluidbookresize', resizeHome);\r
     resizeHome();\r
     initScrollify();\r
 \r
+\r
     // Bouncing scroll down arrow\r
     // Show scroll-down arrow after a small delay\r
     setTimeout(function () {\r
@@ -22,6 +25,7 @@ function load_home() {
     // Handle clicks on pagination dots\r
     $(".pagination li").on("click", function () {\r
         $.scrollify.move($(this).data('section'));\r
+        return false;\r
     });\r
 \r
     // Disable scrollify when popups are open because it\r
@@ -122,6 +126,7 @@ function initScrollify() {
         interstitialSection: '.auto-height',\r
         setHeights: false,\r
         before: function (index, sections) {\r
+            lastDotIndex = index;\r
             //fb("before: #" + index, sections.length);\r
 \r
             // Handle scrolling to last (footer) section\r
@@ -149,26 +154,36 @@ function initScrollify() {
                 }, 300);\r
 \r
             }\r
+            // Pagination update\r
+            var ref = sections[lastDotIndex].attr('data-section-name');\r
+            $(".pagination .active").removeClass('active');\r
+            $(".pagination").find('[data-section="#' + ref + '"]').addClass('active');\r
+        },\r
+        after: function (index, sections) {\r
+            if (index !== lastDotIndex) {\r
+                return;\r
+            }\r
 \r
             // Pagination update\r
-            var ref = sections[index].attr('data-section-name');\r
-            var color = sections[index].attr('data-themecolor');\r
-            $(".pagination .active").css('color', '').removeClass('active');\r
-            $(".pagination").find('[data-section="#' + ref + '"]').css('color', color).addClass('active');\r
+            var ref = sections[lastDotIndex].attr('data-section-name');\r
+            $(".pagination .active").removeClass('active');\r
+            $(".pagination").find('[data-section="#' + ref + '"]').addClass('active');\r
         },\r
         afterRender: function () {\r
             var pagination = '<ul class="pagination">';\r
+            var css = '';\r
 \r
             $('[data-section-name]').each(function (i) {\r
+                css += '.pagination li[data-section="#' + $(this).attr('data-section-name') + '"]:hover,.pagination li[data-section="#' + $(this).attr('data-section-name') + '"].active{';\r
+                css += 'color:' + $(this).data('themecolor') + ';';\r
+                css += '}';\r
                 pagination += '<li data-section="#' + $(this).attr('data-section-name') + '"><span class="hover-text">' + $(this).attr('data-section-name').charAt(0).toUpperCase() + $(this).attr('data-section-name').slice(1) + '</span></li>';\r
             });\r
 \r
             pagination += "</ul>";\r
 \r
+            pagination = '<style type="text/css">' + css + '</style>' + pagination;\r
             $('body').append(pagination);\r
-\r
-            // Highlight first dot\r
-            $('.pagination li:first-of-type').css('color', $('[data-section-name]:first-of-type').data('themecolor')).addClass('active');\r
         }\r
     });\r
 }\r