gbindex.js
1.35 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
(function(){
if($("#data-indexlibrary-tmpl").length){
var map = {creationdate:''};
identityService.findAllLibraries(map, {
callback:function(gbdata){
var template = Handlebars.compile($("#data-indexlibrary-tmpl").html()),
libs = template(gbdata);
$('#gblatestlibrary').html(libs);
$('.libdescpopover').popover({
trigger: 'hover'
});
}
});
}
})();
$.fn.isOnScreen = function(){
var viewport = {};
viewport.top = $(window).scrollTop();
viewport.bottom = viewport.top + $(window).height();
var bounds = {};
bounds.top = this.offset().top;
bounds.bottom = bounds.top + this.outerHeight();
return ((bounds.top <= viewport.bottom) && (bounds.bottom >= viewport.top));
};
//scroll到下一个section
$('#scrollhandler').click(function(){
if($(".infoheader").isOnScreen()){
$(window).scrollTo($(".codereplayarea"), 1200, { easing:'swing', queue:true, axis:'xy' });
}else if($(".codereplayarea").isOnScreen()){
$(window).scrollTo($(".liveheader"), 1200, { easing:'swing', queue:true, axis:'xy' });
}else if($(".liveheader").isOnScreen()){
$(window).scrollTo($(".gbcommunityarea"), 1200, { easing:'swing', queue:true, axis:'xy' });
}else if($(".gbcommunityarea").isOnScreen()){
$(window).scrollTo($(".infoheader"), 1200, { easing:'swing', queue:true, axis:'xy' });
}
});