orbit-basic/app/assets/javascripts/lib/member/member.js

55 lines
1.8 KiB
JavaScript

// Go to
!function ($) {
$.fn.goTo = function (){
var $this = this,
$destination = $this.attr('href'),
$offset = $($destination).offset();
$this.on(clickEvent, function() {
$("html, body").animate({
scrollTop: $offset.top,
}, 500);
return false;
});
}
}(window.jQuery);
function checkHeight() {
if($('#member-module').height() > $(window).height()) {
H = $(window).height()-
parseInt($('.wrap-inner').css('padding-top'))+
parseInt($('.wrap-inner').css('padding-bottom'))-
$('#orbit-bar').outerHeight(true);
}else{
H = $(window).height()-
parseInt($('.wrap-inner').css('padding-top'))+
parseInt($('.wrap-inner').css('padding-bottom'))-
$('#filter').outerHeight()+
parseInt($('#filter').css('margin-bottom'))-
$('#orbit-bar').outerHeight(true);
};
$('#basic-info').height(H);
$('#member-roles').height(H-$('.member-avatar').outerHeight(true)-parseInt($('#member-roles').css('margin-top')))
};
$(function() {
var H;
checkHeight();
$(window).resize(function() {
checkHeight();
// setModuleBlockWidth();
});
$('#member-roles h4 > span').each(function() {
$(this).css('margin-left',function() {
return $(this).innerWidth()/2*-1;
})
})
$('#basic-info').scrollToFixed({
marginTop: $('#orbit-bar').outerHeight(true)+20,
});
$('#module-navbar').scrollToFixed({
marginTop: $('#orbit-bar').outerHeight(true),
});
// $('.member-avatar').imagesLoaded(function() {
// $('#basic-info .member-avatar img').muImageResize({width: 100, height:100});
// });
$('#member-roles').nanoScroller({ scrollTop: 0, iOSNativeScrolling: true });
})