0

我有一个 jvectormap 和一些标记,只要单击并选择一个标记,就会在 div 中加载一个外部页面。我想一次只启用一个标记,现在每次单击同一个标记时外部页面都会重新加载,所以我想禁用它(也将指针更改为光标)。谢谢!

markersSelectable: true,
markersSelectableOne: true,
...
onMarkerClick:function(event, id)
    { 
    // window.location.replace("links/'+code+'.html"); 
    $('#maincontent').load('links/loc'+id+'.html', function(){
            $('#maincontent').css('width', 0);
            $(this).animate({width: '27%'}, 200);
...
4

1 回答 1

1

我不熟悉 jvectormaps,但如果我对您的代码做出一些假设并正确理解您的问题,这样的事情可能会起作用:

markersSelectable: true,
markersSelectableOne: true,
...
onMarkerClick:function(event, id) { 

    if ($("#maincontent").data('current-url') == 'links/loc'+id+'.html') {
        return false;
    }

    $("#maincontent").data('current-url', 'links/loc'+id+'.html')
        .load('links/loc'+id+'.html', function(){
            $('#maincontent').css('width', 0);
            $(this).animate({width: '27%'}, 200);
...
于 2015-04-16T04:04:59.320 回答