Make a GroupFocus scrollable / dynamically adjust a GroupFocus height?

I haven’t tested this, but was trying to think through all of the values you would need. I would trigger it in workflow “when the GF is visible”.

function resize() {
// the current height of the window
var h = window.innerHeight;

// the object to update
var target = $('#gf-users');

// the position of the top of the target obejct
var topOfTarget = target.position().top

// the full height of the target object 
var targetHeight = target.outerHeight;

// the height between the top of the target object and the bottom of the window
var result = h - topOfTarget + 'px';

// the current position of the bottom of the target. So we can see if it's below the bottom of the window and trigger the resize.
var bottomOfTargetPosition = topOfTarget + targetHeight;

// make the GF scrollable and fit within the window if the bottom of it is below the bottom of the screen. 
if(bottomOfTargetPosition > h){	
$('#gf-users').css({'height':result, 'overflow-y':'auto'});
}

resize();

$(window).resize(function() {
    resize();
});
1 Like