1.复制以下代码或者自己创建代码和风天气插件创建页面

调整 lefttop数值以修改位置

<div id="he-plugin-simple"></div>
<script>
WIDGET = {
  CONFIG: {
    "modules": "01234",
    "background": 5,
    "tmpColor": "4A4A4A",
    "tmpSize": 16,
    "cityColor": "4A4A4A",
    "citySize": 16,
    "aqiSize": 16,
    "weatherIconSize": 24,
    "alertIconSize": 18,
    "padding": "10px 10px 10px 10px",
    "shadow": "0",
    "language": "auto",
    "borderRadius": 5,
    "fixed": "true",
    "vertical": "middle",
    "horizontal": "center",
    "left": "290",        //左边的距离
    "top": "5",          //高度
    "key": "ab70696888c44ccf90cb3dc181b7ccef"
  }
}
</script>
<script src="https://widget.heweather.net/simple/static/js/he-simple-common.js?v=1.1"></script>

2.复制生成后,打开Handsome主题目录下打开 component文件夹,编辑里面的 headnav.php文件,在大约在122行后(handsome版本6、7通用)加入复制的代码

                <!--搜索提示-->
                <ul id="search_tips_drop" class="small-scroll-bar dropdown-menu hide" style="display: block;top: 
                30px; leftphp  id="icon-search"><i data-feather="search"></i></span>
                      <span class="feathericons animate-spin  hide" id="spin-search"><i
                                  data-feather="loader"></i></span>
                      <!--                      <i class="fontello fontello-search" id="icon-search"></i>-->
                      <!--                      <i class="animate-spin  fontello fontello-spinner hide" id="spin-search"></i>-->
                  </button>
              </span>
            </div>
        </div>

   复制到这里
  
    </form>
    <a href="" style="display: none" id="searchUrl"></a>
    <!-- / search form -->
    <?php
    $hideReadModeItem = false;
    $hideTalkItem = false;
    $headerItemsOutput = "";
    if (!empty(Typecho_Widget::widget('Widget_Options')->headerItems)){
        $json = '['.Utils::remove_last_comma(Typecho_Widget::widget('Widget_Options')->headerItems).']';

效果见本博客顶部天气

最后修改:2021 年 06 月 28 日
如果觉得我的文章对你有用,请随意赞赏