bzr branch
http://gegoxaren.bato24.eu/bzr/lenasys/trunk
19.3.2
by Adam Ringhede
Makes CodeViewer look and behave like Code Viewer Alt and fixes several issues in CodeViewer, like the hiding and showing of the sidebar, animating the scrolling, adding a missing button, etc. |
1 |
var menuTopOffset = 40; |
2 |
var menuLeftOffset = 25; |
|
3 |
||
4 |
$(document).ready(function() { |
|
5 |
// window.onresize = fixMenuLeft;
|
|
6 |
//$('#menu').offset({ top: menuTopOffset, left: $('#menu').offset().left }); |
|
7 |
//window.onscroll = moveMenu; |
|
8 |
$('#menuHeader').click(toggleMenu);/* |
|
9 |
|
|
10 |
*/
|
|
11 |
$("a.menuLink").click(function(event) { |
|
12 |
event.preventDefault(); |
|
13 |
event.stopPropagation(); |
|
14 |
var destination = event.target.href.substring(event.target.href.lastIndexOf('#') + 1); |
|
15 |
scrollTo(destination); |
|
16 |
}); |
|
17 |
var sidebar = $('#sidebar'); |
|
18 |
$(window).bind('scroll', function() { |
|
19 |
sidebar.css("top", $(window).scrollTop()); |
|
20 |
}); |
|
21 |
$('.ieCSS3Fix, .group h2').each(function() { |
|
22 |
PIE.attach(this); |
|
23 |
}); |
|
24 |
});
|
|
25 |
||
26 |
function fixMenuLeft(ev) { |
|
27 |
//$('#menu').offset({ top: bodyelem.scrollTop()+menuTopOffset, left: -($('#menu').width()-30) }); |
|
28 |
if($('#menu').offset().left != 0) { |
|
29 |
$('#menu').offset({ top: $('#menu').offset().top, left: -($('#menu').width()-menuLeftOffset) }); |
|
30 |
} |
|
31 |
}
|
|
32 |
||
33 |
function toggleMenu(ev) { |
|
34 |
if($('#menu').offset().left == 0) { |
|
35 |
$('#menu').stop().animate({ left: -($('#menu').width()-menuLeftOffset) },{duration:900}); |
|
36 |
$("#menuArrow").addClass("rotateArrowCW"); |
|
37 |
} else { |
|
38 |
$('#menu').stop().animate({ left: 0 },{duration:900}); |
|
39 |
$("#menuArrow").removeClass("rotateArrowCW"); |
|
40 |
} |
|
41 |
}
|
|
42 |
||
43 |
function moveMenu(ev){ |
|
44 |
if($.browser.webkit) { |
|
45 |
bodyelem = $("body"); |
|
46 |
} else { |
|
47 |
bodyelem = $("html,body"); |
|
48 |
} |
|
49 |
$('#menu').offset({ top: bodyelem.scrollTop()+menuTopOffset, left: $('#menu').offset().left }); |
|
50 |
}
|
|
51 |
||
52 |
function scrollTo(id){ |
|
53 |
$('html,body').animate({scrollTop: $("#"+id).offset().top},{duration:900}); |
|
54 |
return false; |
|
55 |
}
|