I have written this code to resize the icon on resizing the browser. The code does not work when clicking the maximaize button or the minimaize button.
How can I enable invoking my displayWindowSize
function when clicking the maximaize and minimaize button in the browser to resize the switch_ico
icon?
<script>
//window.onresize = displayWindowSize;
//window.onload = displayWindowSize;
$(window).resize(function()
{
setTimeout(function() {
displayWindowSize();
}, 100);
});
function displayWindowSize() {
var tpReportWidth = $("#tpReport").width();
var iconWidth = $("#switch_icon").width();
var newIconWidth = Math.round(tpReportWidth/49.6).toFixed(2)
console.log('tpReportWidth: ' + tpReportWidth + " ,iconWidth: " + iconWidth + 'newIconWidth: ' + newIconWidth);
$("#switch_icon").attr('height',newIconWidth);
$("#switch_icon").attr('width',newIconWidth);
};
</script>