I'm actually trying load image based on its screen size. Code seems to be right but for some reason its not displaying the image. Path is right开发者_如何学Go..Any insight?? Here is my Page and my code
You have the following line:
$("#wide").attr("src","http://imgur.com/TPwe7");
That's putting a src
attribute on the div
. You want to put it on the img
(and use a real image URL):
$("img", detector).attr("src","http://i.imgur.com/sW6hi.png");
Replace
$("#wide").attr("src","http://imgur.com/TPwe7");
With
$("#wide").find('img').attr("src","http://imgur.com/TPwe7");
精彩评论