Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/70.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 如何从API获取雅虎天气背景?_Javascript_Jquery_Json_Yahoo Api_Yahoo Weather Api - Fatal编程技术网

Javascript 如何从API获取雅虎天气背景?

Javascript 如何从API获取雅虎天气背景?,javascript,jquery,json,yahoo-api,yahoo-weather-api,Javascript,Jquery,Json,Yahoo Api,Yahoo Weather Api,我有一个天气小部件,我需要动态背景。雅虎有天气API,但我找不到与天气类型相关的背景图像。这可能吗 var url = 'http://query.yahooapis.com/v1/public/yql?q=select%20*%20from%20weather.forecast%20where%20location%3D%2248907%22&format=json' $.getJSON(url, function (data) {

我有一个天气小部件,我需要动态背景。雅虎有天气API,但我找不到与天气类型相关的背景图像。这可能吗

var url = 'http://query.yahooapis.com/v1/public/yql?q=select%20*%20from%20weather.forecast%20where%20location%3D%2248907%22&format=json'
            $.getJSON(url, function (data) {
                console.log(data)
            })

很抱歉,没有用于此的API。 但是,您可以通过浏览器开发人员工具查看网络活动来访问他们的背景

最好的解决方案是用自己的图像构建自己的Api

这是三个背景url的示例:


API不提供任何图像,但您可以使用大量数据自己提供图像。例如,请使用以下属性

condition":{"code":"34", ...  // here you can bind an image to the code
然后你有一个风的物体

wind":{
  "chill":"55",       // thermometer?
  "direction":"0",     // use an image or a canvas to draw an arrow dynamically
  "speed":"0"
}, ...
还有一个大气物体

"atmosphere":{
  "humidity":"51",     // some drops?
  "pressure":"30.4",   // textual..
  "rising":"2",
  "visibility":"10"    // textual..
}, ...

等等。正如您所见,有许多方法可以说明这些数据,但如何说明完全取决于您。

他们提供了数据。。。。如何显示它取决于您。您需要解析结果来管理自己的图像显示显示显示结果中背景图像的位置?我不相信他们在那里。