Replaced $(document).ready(function() with $(window).load(function()