“Always on ” jquery command

前端 未结 2 1165
北恋
北恋 2021-01-29 02:16

recently i\'m working on a project to make an interactive directory map for a mall without using flash, because they need to access from mobile devices.

but i have issu

2条回答
  •  [愿得一人]
    2021-01-29 03:04

    The problem is you don't turn off the highlight for currently selected area when clicking on another.

    Place this:

    $('.selected').data('maphilight', {alwaysOn: false}).trigger('alwaysOn.maphilight');
    

    in your salhia.js, in the .mapclick click handler:

    $('.mapclick').click(function(){
        $('.selected').data('maphilight', {alwaysOn: false}).trigger('alwaysOn.maphilight');
    
        $('.mapclick').removeClass('selected');
        $(this).addClass('selected');
    
        var shop = '.shopdetails#' + $(this).attr('shop');
        var htmlCode = $(shop).html();
    
        $('.shopinfo').fadeOut(500, function(){
            $('.shopinfo .shopdetails').html(htmlCode);
            $('.shopinfo').fadeIn(500);
        });
    });
    

提交回复
热议问题