gbindex.js 1.35 KB
(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' });
	}
});