Dynamically load css stylesheet and wait for it to load
问题 I have a script where I load a css stylesheet when pressing a button like this: link = "<link class='listcss' rel='stylesheet' href='http://....list.css'>"; $("head").append(link); Then I need to do some calculations based on the css width and height properties: function CSSDone(){ if($(window).width()>640){ $(".grid-item").css({"height":$(".grid-item").width()*0.2}); $(".grid_item_img").css({"height":$(".grid-item").width()*0.2}); console.log("a"); }else{ $(".grid-item").css({"height":$("