Skip to content

Commit

Permalink
fix(doc): js indentation
Browse files Browse the repository at this point in the history
  • Loading branch information
ygatesoupe committed Jan 14, 2016
1 parent bf8a2c0 commit 9737dce
Showing 1 changed file with 46 additions and 45 deletions.
91 changes: 46 additions & 45 deletions docs-orange/assets/js/src/application-orange.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,61 +9,62 @@

$(document).ready(function () {

$(window).scroll(function () {
if ($(this).scrollTop() > 100) {
$('.scrollup').fadeIn();
} else {
$('.scrollup').fadeOut();
}
});
$(window).scroll(function () {
if ($(this).scrollTop() > 100) {
$('.scrollup').fadeIn();
} else {
$('.scrollup').fadeOut();
}
});

$('.scrollup').click(function () {

$('.scrollup').click(function () {
$('html, body').animate({
scrollTop: 0
}, 600);
return false;
});
});
$('html, body').animate({
scrollTop: 0
}, 600);

})
return false;
});
});
})
}(jQuery);

(function () {
'use strict';
'use strict';

function isElementInViewport(el, topOffset) {
var rect = el.getBoundingClientRect();
function isElementInViewport(el, topOffset) {
var rect = el.getBoundingClientRect();

if (!topOffset){ topOffset = 0; }
if (!topOffset){ topOffset = 0; }

return rect.bottom > topOffset &&
rect.right > 0 &&
rect.left < (window.innerWidth || document. documentElement.clientWidth) &&
rect.top < (window.innerHeight || document. documentElement.clientHeight);
}
return rect.bottom > topOffset &&
rect.right > 0 &&
rect.left < (window.innerWidth || document. documentElement.clientWidth) &&
rect.top < (window.innerHeight || document. documentElement.clientHeight);
}

function onVisibilityChange(el) {
return function () {
var sidebar = document.getElementById('docsNavbarContent');
function onVisibilityChange(el) {
return function () {
var sidebar = document.getElementById('docsNavbarContent');

if (isElementInViewport(el)) {
sidebar.style.position = 'static';
sidebar.style.top = 'auto';
} else {
sidebar.style.position = 'fixed';
sidebar.style.top = '0';
}
};
}
if (isElementInViewport(el)) {
sidebar.style.position = 'static';
sidebar.style.top = 'auto';
} else {
sidebar.style.position = 'fixed';
sidebar.style.top = '0';
}
};
}

window.onload = function () {
var pageHeader = document.getElementById('page_header');
var pageWatcher = onVisibilityChange(pageHeader);
window.onload = function () {
var pageHeader = document.getElementById('page_header');
var pageWatcher = onVisibilityChange(pageHeader);

if (window.addEventListener) {
addEventListener('scroll', pageWatcher, false);
} else if (window.attachEvent) {
attachEvent('onscroll', pageWatcher);
}
};
if (window.addEventListener) {
addEventListener('scroll', pageWatcher, false);
} else if (window.attachEvent) {
attachEvent('onscroll', pageWatcher);
}
};
})();

0 comments on commit 9737dce

Please sign in to comment.