jquery天气插件

所属分类:其他-独立的部件

 124082  369  查看评论 (13)
分享到微信朋友圈
X
jquery天气插件 ie兼容10

一个简单的jQuery插件可以显示当前的天气信息,使用雅虎天气的任何位置。开发者James Fleeting。下载最新的版本,阅读文档或浏览常见问题解答simpleweather.js。下面你会发现使用simpleWeather.js的一个例子。

用法

只需在您的网站jquery.simpleWeather.js。然后初始化simpleWeather,设置您的WOEID,美国邮递区号或位置,添加一个div与``天气的ID(或任何你想要的,只是改变它在init)。

html

<div id="weather"></div>


css

body {
  font: 13px 'Open Sans', "Helvetica Neue", Helvetica, Arial, "Lucida Grande", sans-serif;
  background: #0091c2;
}
#weather {
  width: 425px;
  margin: 0px auto;
  text-align: center;
  text-transform: uppercase;
}
#weather h2 {
  margin: 0 0 8px;
  color: #fff;
  font-size: 150px;
  font-weight: 300;
  text-align: center;
  text-shadow: 0px 1px 3px rgba(0, 0, 0, 0.15);
}
#weather ul {
  margin: 0;
  padding: 0;
}
#weather li {
  background: #fff;
  background: rgba(255,255,255,0.90);
  padding: 20px;
  display: inline-block;
  border-radius: 5px;
}
#weather .currently {
  margin: 0 20px;
}


js

$(document).ready(function() {
  $.simpleWeather({
    zipcode: '',
    woeid: '2357536',
    location: '',
    unit: 'f',
    success: function(weather) {
      html = '<h2>'+weather.temp+'&deg;'+weather.units.temp+'</h2>';
      html += '<ul><li>'+weather.city+', '+weather.region+'</li>';
      html += '<li class="currently">'+weather.currently+'</li>';
      html += '<li>'+weather.tempAlt+'&deg;C</li></ul>';
  
      $("#weather").html(html);
    },
    error: function(error) {
      $("#weather").html('<p>'+error+'</p>');
    }
  });
});


相关插件-独立的部件

可停靠屏幕边缘的侧边栏插件

我自己封装的可停靠屏幕边缘的侧边栏插件,可以制作页面的通知信息,客服信息,联系方式等
  独立的部件
 36732  452

jQuery实现弹幕实例

一个很好用的实例,适合新手
  独立的部件
 29249  332

jQuery前端excel导入插件xlsx.core.js

此插件作用可以把excel表,导入到网页中用table显示出来
  独立的部件
 56087  415

可自定义轻量侧边悬浮插件

可以自定义悬浮.邮箱、QQ、电话、二维码等....
  独立的部件
 46417  615

讨论这个项目(13)回答他人问题或分享插件使用方法奖励jQ币 评论用户自律公约

    CSMA/CD 0
    2018/7/12 9:03:40
    →_→ 0
    2017/5/24 10:13:05

    怎么把显示出来的地址和天气改成中文的

    回复
    Alexre_Dumas 0
    2016/11/21 21:11:01
    做到一半发现只能美国用 回复
    多柠檬* 0
    2016/8/5 14:08:51
    怎么初始化simpleWeather 回复
    emillet 0
    2016/3/29 10:03:29
    为什么我的出来的效果没有图片。。。只有文字 回复
    Beyonce Int 0
    2016/3/15 16:03:36
    ~L+Z~ 0
    2016/2/16 16:02:18
    只能美国用  有毛用啊? 回复
    枫真的疯啦 0
    2016/1/28 10:01:30

    如何找到对应城市的WOEID

        多柠檬*0
        2016/8/5 14:08:32
        这个网站可以查http://zourbuth.com/tools/woeid/
        baidilejishi0
        2016/8/8 17:08:20
        不过貌似只能用美国的区号
    回复
    他色┝┿?想 0
    2015/8/25 9:08:58

    不错哦

        Alisa0
        2016/1/13 13:01:49

        恩,我也觉的不错

        Alexre_Dumas0
        2016/11/21 21:11:14
        只能看看
    回复
😃
  • 😀
  • 😉
  • 😥
  • 😵
  • 😫
  • 😘
  • 😡
  • 👍
  • 🌹
  • 👏
  • 🍺
  • 🍉
  • 🌙
  • 💖
  • 💔
😃
  • 😀
  • 😉
  • 😥
  • 😵
  • 😫
  • 😘
  • 😡
  • 👍
  • 🌹
  • 👏
  • 🍺
  • 🍉
  • 🌙
  • 💖
  • 💔
取消回复