$(document).ready(function(){
function adjustMenuWidth()
{
var windowSize = $(this); //this refers to the window
windowWidth = windowSize.width();
leftMarginWidth = parseInt($('.topbarcontainer').css("margin-left"));
rightMarginWidth = parseInt($('.topbarcontainer').css("margin-right"));
extraSpace = 25;
additionalAccountSpace = extraSpace + 42;
var widthForRequest = windowWidth - leftMarginWidth - rightMarginWidth - extraSpace;
var widthForAccount = windowWidth - leftMarginWidth - rightMarginWidth - additionalAccountSpace;
$(".menuRequestCowork").css('min-width',widthForRequest+'px');
$(".menuAccount").css('min-width',widthForAccount+'px');
}
$(window).on('resize', function(){
adjustMenuWidth();
});
adjustMenuWidth();
});
This code checks the window size and then calculates the width by subtracting the left and right margins. It is functioning properly.