jquery-ui:使用jquery

时间:2017-11-08 05:29:37

标签: javascript jquery jquery-ui tooltip jquery-ui-tooltip

大家好,任何人都可以帮我这个我想通过点击我用来打开工具提示的相同div来关闭/关闭我的工具提示,我不想使用典型的   style.display == 'block'; 我想使用jquery show() / hide()

这是我的代码

function DisplayByClick(sender) 
{
var html = '';
var mapDiv = document.getElementById('mapContainer'), i = 0,
    dataIndex, tooltipDiv, key,
    mapMarkers = $(mapDiv).find('.e-mapMarker'), index = 0;
var collection = [];
collection = collection.concat(flsSites, flsInstallation, flsProduct);
var currentMarker = sender.originalEvent.marker[0];
var sites = $('#fls_site').attr('data-flag');
var installation = $('#fls_installation').attr('data-flag');
var product = $('#fls_products').attr('data-flag');

for (i = 0; i < mapMarkers.length; i++) {
    if (currentMarker == mapMarkers[i]) {
        index = i;
        break;
    }
}

html += '<div id="infocontainer" class="map_element">';
html += '<div class="p-image"><img src="src/images/retrofit.png"/></div>';
html += '<div class="popupdetail">';
html += '<div class="p-name"> Site Name: ' + collection[index].site_name + '</div>';
html += '<div class="p-name"> Site Status: ' + collection[index].status + '</div>';
html += '<div class="p-name"> Country: ' + collection[index].country_name + '</div>';
html += '</div>';
html += '</div>';

$("#map_tooltip" + index).remove();
if (document.getElementById('map_tooltip' + index) == null) {
    markerTooltipdiv = $("<div></div>").attr('id', "map_marker_tooltip" + index);
    $("#markerTooltipContainer").append(markerTooltipdiv);
    $(markerTooltipdiv).css({
        "display": "block", "padding": "5px",
        "position": "absolute",
        "z-index": "13000", "float": "left",
        "cursor": "default",
        "font-family": "Segoe UI",
        "color": "#707070",
        "font-size": "12px",
        "left": parseInt(currentMarker.style.left) + 30,
        "top": parseInt(currentMarker.style.top) + 15,
        "background-color": "#FFFFFF",
        "border": "1px solid #707070"
    });
    $(markerTooltipdiv).html(html);
    $(tooltipdiv).html(html);
    //$(markerTooltipdiv).html(html).toggle().css({"display":none });
   // $('.rightcontainer').eq($(this).index()).addClass('background');
}
}

我很抱歉英文不好fyi

0 个答案:

没有答案