我正在制作一个电影建议应用,它会根据用户地理位置的天气来推荐电影。
我遇到的主要问题是,我希望能够通过选择附加到单一天气状况的电影来制作电影的随机标题和海报。
现在我有一个按钮,在我的HTML中,基本上只是将你移动到列表中并停在最后一个。我怎样才能使按钮生成一个随机电影标题和随附的海报?
if (icon === "wind") {
$("#jumbo").css(
"background-image",
"url(https://www.movieposter.com/posters/archive/main/66/MPW-33473)"
);
$("body").css(
"background-image",
"url(https://i.ytimg.com/vi/Gfr8MExtDYI/maxresdefault.jpg)"
);
$("#cTemp").html("Twister");
$("#new").click(function() {
$("#jumbo").css(
"background-image",
"url(https://images-na.ssl-images-amazon.com/images/I/517KxZHTGGL.jpg)"
);
$("#cTemp").html("Cast Away");
$("#new").click(function() {
$("#jumbo").css(
"background-image",
"url(http://www.gstatic.com/tv/thumb/movieposters/34439/p34439_p_v8_au.jpg)"
);
$("#cTemp").html("The Day After Tomorrow");
$("#new").click(function() {
$("#jumbo").css(
"background-image",
"url(http://www.gstatic.com/tv/thumb/movieposters/193479/p193479_p_v8_an.jpg)"
);
$("#cTemp").html("2012");
$("#new").click(function() {
$("#jumbo").css(
"background-image",
"url(https://i.pinimg.com/originals/dc/0c/ff/dc0cff626f513bd5fc74bb9dbde70f17.jpg)"
);
$("#cTemp").html("Gone With The Wind");
$("#new").click(function() {
$("#jumbo").css(
"background-image",
"url(https://images-na.ssl-images-amazon.com/images/I/81dTEnx805L._RI_.jpg)"
);
$("#cTemp").html("The Perfect Storm");
});
});
});
});
});
}