Skip to content

Commit

Permalink
Set default displayScrollbar to false
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelbromley committed Aug 29, 2014
1 parent 7f188bb commit ebf924f
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 11 deletions.
13 changes: 8 additions & 5 deletions dist/horizonal.debug.js
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ function Horizonal() {
staggerDelay: 0.1,
stagger: 'random',
customCssFile: false,
displayScrollbar: true,
displayScrollbar: false,
scrollbarShortenRatio: 2, // long scrolling between pages can be a pain, so a higher value here will shorten the scroll distance between pages
pageMargin: 20,
displayPageCount: true,
Expand Down Expand Up @@ -225,8 +225,8 @@ function Horizonal() {
$(window).on('touchstart pointerdown MSPointerDown', touchstartHandler);
$(window).on('touchend pointerup MSPointerUp', touchendHandler);
$(window).on('touchmove pointermove MSPointerMove', touchmoveHandler);
$('a').on('click', linkHandler);
$(window.document).on('wheel', mousewheelHandler);
$('a').on('click', linkHandler);
}

function unregisterEventHandlers() {
Expand All @@ -237,6 +237,7 @@ function Horizonal() {
$(window).off('touchstart pointerdown MSPointerDown', touchstartHandler);
$(window).off('touchend pointerup MSPointerUp', touchendHandler);
$(window).off('touchmove pointermove MSPointerMove', touchmoveHandler);
$(window.document).off('wheel', mousewheelHandler);
$('a').off('click', linkHandler);
}

Expand Down Expand Up @@ -303,6 +304,11 @@ function composePage(currentScroll) {
// a setTimeout is used to force async execution and allow the loadingIndicator to display before the
// heavy computations of composePage() are begun.
setTimeout(function() {

if (!OPTIONS.displayScrollbar) {
$('body').css('overflow-y', 'hidden');
}

var allNodes = new NodeCollection(OPTIONS.selector);

PAGE_COLLECTION = pageCollectionGenerator.fromNodeCollection(allNodes);
Expand All @@ -327,9 +333,6 @@ function composePage(currentScroll) {

var documentHeight = PAGE_COLLECTION.last().bottom / OPTIONS.scrollbarShortenRatio + VIEWPORT_HEIGHT;
ROOT.height(documentHeight);
if (!OPTIONS.displayScrollbar) {
$('body').css('overflow-y', 'hidden');
}
renderPageCount();
removeLoadingIndicator();
deferred.resolve();
Expand Down
2 changes: 1 addition & 1 deletion dist/horizonal.min.js

Large diffs are not rendered by default.

Binary file modified dist/horizonal.zip
Binary file not shown.
8 changes: 5 additions & 3 deletions src/common.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,11 @@ function composePage(currentScroll) {
// a setTimeout is used to force async execution and allow the loadingIndicator to display before the
// heavy computations of composePage() are begun.
setTimeout(function() {

if (!OPTIONS.displayScrollbar) {
$('body').css('overflow-y', 'hidden');
}

var allNodes = new NodeCollection(OPTIONS.selector);

PAGE_COLLECTION = pageCollectionGenerator.fromNodeCollection(allNodes);
Expand All @@ -44,9 +49,6 @@ function composePage(currentScroll) {

var documentHeight = PAGE_COLLECTION.last().bottom / OPTIONS.scrollbarShortenRatio + VIEWPORT_HEIGHT;
ROOT.height(documentHeight);
if (!OPTIONS.displayScrollbar) {
$('body').css('overflow-y', 'hidden');
}
renderPageCount();
removeLoadingIndicator();
deferred.resolve();
Expand Down
5 changes: 3 additions & 2 deletions src/horizonal.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ function Horizonal() {
staggerDelay: 0.1,
stagger: 'random',
customCssFile: false,
displayScrollbar: true,
displayScrollbar: false,
scrollbarShortenRatio: 2, // long scrolling between pages can be a pain, so a higher value here will shorten the scroll distance between pages
pageMargin: 20,
displayPageCount: true,
Expand Down Expand Up @@ -112,8 +112,8 @@ function Horizonal() {
$(window).on('touchstart pointerdown MSPointerDown', touchstartHandler);
$(window).on('touchend pointerup MSPointerUp', touchendHandler);
$(window).on('touchmove pointermove MSPointerMove', touchmoveHandler);
$('a').on('click', linkHandler);
$(window.document).on('wheel', mousewheelHandler);
$('a').on('click', linkHandler);
}

function unregisterEventHandlers() {
Expand All @@ -124,6 +124,7 @@ function Horizonal() {
$(window).off('touchstart pointerdown MSPointerDown', touchstartHandler);
$(window).off('touchend pointerup MSPointerUp', touchendHandler);
$(window).off('touchmove pointermove MSPointerMove', touchmoveHandler);
$(window.document).off('wheel', mousewheelHandler);
$('a').off('click', linkHandler);
}

Expand Down

0 comments on commit ebf924f

Please sign in to comment.