Repository navigation
Expand file tree
/
Copy pathapp.js
More file actions
52 lines (44 loc) · 1.58 KB
/
Copy pathapp.js
File metadata and controls
52 lines (44 loc) · 1.58 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
/* UI-related code, which is not expected to influence Ur/Web functioning.
Includes:
* click interval adjustments for mobile devices
* smooth scrolling
* menu positioning.
*/
jQuery(function ($) {
// make menu visible everytime on tablets and larger screens
function positionMenu() {
var viewportHeight = window.innerHeight;
var menuHeight = $('.menu').height();
var logoHeight = viewportHeight - menuHeight;
var releaseAt = $('.img_resp').height();
if (($(window).scrollTop() > releaseAt) && (window.innerWidth > 768)){
$('.menu').css({position: 'fixed', top: '0px'});
} else {
$('.menu').css({position: 'relative'});
};
}
window.addEventListener("orientationchange", positionMenu);
$(window).scroll(positionMenu);
$(window).resize(positionMenu);
positionMenu();
// END make menu visible everytime on tablets and larger screens
// remove 300ms delay on mobile devices
FastClick.attach(document.body);
// remove 300ms delay on mobile devices
// smooth scrolling for intra-page anchors
$('.menu a').bind('click', function (e) {
var hash = "#" + $(this).attr('href').split("#").pop();
var target = $(hash);
$('html, body').stop().animate(
{
scrollTop: target.offset().top
},
{
duration: 150,
complete: function (){ window.location.hash = hash; }
}
);
e.preventDefault();
});
// END smooth scrolling for intra-page anchors
});