I have code to resize my Tabs to match the browser size. The problem is when I call this method inside of $(document).ready it does not resize the 1st tab. The others seem to size just fine. If I move my call to ResizeTabs outside of $(document).ready then it seems to work fine? My question is why?
<div>
@(Html.Kendo().TabStrip()
.Name("PassportTabStrip")
.HtmlAttributes(new { style = "height: 100%;" })
.Items(tabstrip =>
{
tabstrip.Add()
.Text("Users")
.Selected(true)
.LoadContentFrom("GetUsers", "Passport");
tabstrip.Add()
.Text("Roles")
.LoadContentFrom("GetRoles", "Passport");
tabstrip.Add()
.Text("Functions")
.LoadContentFrom("GetFunctions", "Passport");
})
)
</div>
$(document).ready(function ()
{
ResizeTabs();
});
$(window).resize(ResizeTabs);
function ResizeTabs()
{
var tabstrip = $('#PassportTabStrip');
var headerHeight = $('header').height();
var footerHeight = $('footer').height();
var windowHeight = $(window).height();
var newHeight = windowHeight - headerHeight - footerHeight - 50;
tabstrip.css({ height: newHeight + "px" });
var contentHeight = tabstrip.innerHeight() - tabstrip.children('.k-tabstrip-items').outerHeight() - 16;
tabstrip.children('.k-content').height(contentHeight);
}
<div>
@(Html.Kendo().TabStrip()
.Name("PassportTabStrip")
.HtmlAttributes(new { style = "height: 100%;" })
.Items(tabstrip =>
{
tabstrip.Add()
.Text("Users")
.Selected(true)
.LoadContentFrom("GetUsers", "Passport");
tabstrip.Add()
.Text("Roles")
.LoadContentFrom("GetRoles", "Passport");
tabstrip.Add()
.Text("Functions")
.LoadContentFrom("GetFunctions", "Passport");
})
)
</div>
$(document).ready(function ()
{
ResizeTabs();
});
$(window).resize(ResizeTabs);
function ResizeTabs()
{
var tabstrip = $('#PassportTabStrip');
var headerHeight = $('header').height();
var footerHeight = $('footer').height();
var windowHeight = $(window).height();
var newHeight = windowHeight - headerHeight - footerHeight - 50;
tabstrip.css({ height: newHeight + "px" });
var contentHeight = tabstrip.innerHeight() - tabstrip.children('.k-tabstrip-items').outerHeight() - 16;
tabstrip.children('.k-content').height(contentHeight);
}