开发者

Depending on the screen size want to replace the image

开发者 https://www.devze.com 2023-03-14 11:02 出处:网络
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??

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");

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号