0

插件:http ://www.zazar.net/developers/jquery/zweatherfeed/

该插件有两个参数:一个必需的数组“位置”和一个可选的“选项”(没有定义类型)。对于“选项”,给出了“插件选项”列表(请参见上面的链接)。

我想将“unit”的选项设置为“f”,但将参数作为对象传递(按照 jquery 中的正常情况?)不起作用,也没有在 Firebug 中记录任何错误。

<script type='text/javascript'>
jQuery(document).ready(function () {
    jQuery('.site-description').weatherfeed({
        location : ['UKXX0085'],
        unit : 'f'
    });
});

4

3 回答 3

0

根据Zazar.net 文档,您自己的脚本仅设置位置(在此示例中为伦敦)。但是,是的,这通常是您在 jQuery 中设置所有选项的地方。

<script>
$(document).ready(function () {
$('#test').weatherfeed(['UKXX0085']);
});
</script>

要设置 zWeather 的其他选项,您必须直接编辑 jquery.zweatherfeed.js。请注意,我在缩小版本的相关部分将“单位”更改为“f”。

(function(h){var j="odd";h.fn.weatherfeed=function(g,c)
{c=h.extend({unit:"f",image:!0,highlow:!0,wind:!0,link:!0,showerror:!0,linktarget:"_self"},c);
于 2012-08-08T11:16:58.403 回答
0

在本视频中,您将看到如何设置 zWeatherfeed 选项:

http://www.websopen.com/2011/06/06/1227-tweaking-zweatherfeed-display-options-tdi-project/

于 2012-08-06T18:27:37.083 回答
0

您的脚本使用位置作为选项,而不是第一个参数。

例如,在 zWeatherFeed 上配置参数:

<script type="text/javascript">
$(document).ready(function () {
  $('#test').weatherfeed(['UKXX0085','EGXX0011'], {
        unit: 'c',
        image: false,
        showerror: false
  });
});
</script>

http://www.zazar.net/developers/jquery/zweatherfeed/

于 2012-09-05T11:21:45.937 回答