2015-02-03 04:36:49 +01:00
|
|
|
var scrolling = false;
|
2015-02-13 18:09:23 +01:00
|
|
|
var navigatorOpen = false;
|
|
|
|
|
var topButtonVisible = true;
|
2015-01-09 15:18:57 +01:00
|
|
|
|
2015-02-03 04:36:49 +01:00
|
|
|
$(document).ready(function(){
|
2015-01-09 15:18:57 +01:00
|
|
|
|
2015-02-03 04:36:49 +01:00
|
|
|
$(function(){
|
|
|
|
|
$.scrollIt();
|
|
|
|
|
});
|
2015-01-09 15:18:57 +01:00
|
|
|
|
|
|
|
|
|
2015-02-03 04:36:49 +01:00
|
|
|
$(".navigator-toggle").click(function() {
|
2015-02-13 18:09:23 +01:00
|
|
|
if (navigatorOpen){
|
|
|
|
|
closeTopMenu();
|
|
|
|
|
}else{
|
|
|
|
|
openTopMenu();
|
|
|
|
|
}
|
|
|
|
|
navigatorOpen = !navigatorOpen;
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
$(".topic").click(function() {
|
|
|
|
|
closeTopMenu();
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
function openTopMenu(){
|
|
|
|
|
if (!scrolling && !navigatorOpen){
|
2015-02-03 04:36:49 +01:00
|
|
|
scrolling = true;
|
|
|
|
|
$(".navigator").slideDown( "slow", function() {
|
|
|
|
|
scrolling = false;
|
2015-02-13 18:09:23 +01:00
|
|
|
navigatorOpen = true;
|
2015-02-03 04:36:49 +01:00
|
|
|
});
|
|
|
|
|
}
|
2015-02-13 18:09:23 +01:00
|
|
|
}
|
2015-01-09 15:18:57 +01:00
|
|
|
|
2015-02-13 18:09:23 +01:00
|
|
|
function closeTopMenu(){
|
|
|
|
|
if (!scrolling && navigatorOpen){
|
2015-02-03 04:36:49 +01:00
|
|
|
scrolling = true;
|
|
|
|
|
$('.navigator').slideUp( "slow", function() {
|
|
|
|
|
scrolling = false;
|
2015-02-13 18:09:23 +01:00
|
|
|
navigatorOpen = false;
|
2015-02-03 04:36:49 +01:00
|
|
|
});
|
2015-01-09 15:18:57 +01:00
|
|
|
}
|
2015-02-13 18:09:23 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function showTopButton(){
|
|
|
|
|
console.log('showTopButton');
|
|
|
|
|
if (!topButtonVisible){
|
|
|
|
|
$('.top-button').show( "slow", function() {
|
|
|
|
|
topButtonVisible = true;
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function hideTopButton(){
|
|
|
|
|
console.log('hideTopButton');
|
|
|
|
|
if (topButtonVisible){
|
|
|
|
|
$('.top-button').hide( "slow", function() {
|
|
|
|
|
topButtonVisible = false;
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var timeout = null;
|
|
|
|
|
var navbarHeight = $('.navbar').height();
|
|
|
|
|
|
|
|
|
|
$(window).scroll(function () {
|
|
|
|
|
if (!timeout) {
|
|
|
|
|
timeout = setTimeout(function () {
|
|
|
|
|
clearTimeout(timeout);
|
|
|
|
|
timeout = null;
|
|
|
|
|
if ($(window).scrollTop() >= navbarHeight) {
|
|
|
|
|
closeTopMenu();
|
|
|
|
|
showTopButton();
|
|
|
|
|
}else{
|
|
|
|
|
hideTopButton();
|
|
|
|
|
}
|
|
|
|
|
}, 250);
|
|
|
|
|
}
|
2015-02-03 04:36:49 +01:00
|
|
|
});
|
2015-01-09 15:18:57 +01:00
|
|
|
|
|
|
|
|
});
|