I am attempting to use the on() method inside of a function in order to replace the ready() method so I can use more than one event to trigger a function. Here is the general function I am wanting to use it in:
function tableImgScale() {
$(function () {
var bandTableHeight = $('#banddetails').height() + "px";
$(document).ready(function () {
$('#banddetails td:nth-child(1)').css({"height": bandTableHeight, "overflow": "hidden"});
$('#banddetails td img').css({"display": "block", "width": "100%", "height": "100%", "objectFit": "cover"});
});
});
}
So, in simpler terms, I am trying to replace: $(document).ready(function () {...
with: $(document).on('ready resize', function () {...
But it will not work. However, the function with the instance of the .ready() method works perfectly fine. Any help would be appreciated.