/** * Created by Administrator on 2017/11/6. * 标题功能类 */ define([''], function () { var legend = { addLegend: function (id, imgUrl) { //根据功能添加对应ID的色标标签 var height = $(window).height(); height = height - 69; var content = "
  • " + "" + "
  • "; var height2 = $('.meteo-legend-box').height(); if(height2 == 0){ height = height - height2; }else { height = height - height2/2; } $('#meteo-legend-box').append(content); $('.meteo-legend-box').css('top', height); $('.meteo-legend-box').show(); }, removeLegend: function (id) { //根据功能寻找对应ID删除标签 var height = $(window).height(); height = height - 69; var height1 = $('#meteo-legend-' + id).height(); $('#meteo-legend-' + id).remove(); var height2 = $('.meteo-legend-box').height(); height = height - height2/2 + height1/2; $('.meteo-legend-box').css('top', height); if ($('#meteo-legend-box').children().length == 0) $('.meteo-legend-box').hide(); }, init: function () { //初始化,准备标题存放的div var content = "
    " + "" + "
    "; $('#standardTime').append(content); } } legend.init(); return legend; })