“永远在线” jquery命令 [英] "Always on " jquery command

查看:81
本文介绍了“永远在线” jquery命令的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

最近我正在开发一个项目来为商城制作交互式目录地图而不使用闪存,因为他们需要从移动设备访问。

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.

但是我有jquery的问题,我正在使用jquery map highlight的自定义java命令。我用它来定位我的地图线。

but i have issue with jquery , i'm using custom java commands with jquery map highlight. which i use to target my mapcoords.

当有人点击地图或下面的列表时调用方法,它会突出显示地图并显示右侧的信息。

Method is invoked when someone clicks either on the map or the list below, it'll highlight the map and it'll show the information on right side.

我的问题是当有人点击列表中的另一个商店或从地图上点击它时,它不会清除前一个突出显示的块而前一个突出显示的块,它不会无论你点击多少次。

My problem is when somebody clickd another shop from the list or from the map it won't clear the previous highlighted block and the previous one keeps highlighting, it doesn't matter how many time you click.

我需要的是优化我的代码,这样当有人点击第二个链接时,它会自动清除前一个链接。

what i need is to refine my code such that when somebody clicks the 2nd link it will automatically clear the previous one.

任何人都可以在下面的链接中查看我的演示文件
http://www.pad10.com/testsities/directorymap/

anybody can see my demo file under below link http://www.pad10.com/testsities/directorymap/

如果有人帮我这个,我将不胜感激

i'll appreciate if somebody help me with this

推荐答案

更改了上一个答案中显示的代码,因此它更通用:

Changed a bit the code shown on previous answer so it is more generic:

// Init
$('.map').maphilight({
       stroke: false,               
}); 

// Reset all map

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

$('area').click(function(){    
    // Reset all areas with class 'selected'
    $('.selected').data('maphilight', {alwaysOn: false}).trigger('alwaysOn.maphilight');
    // Remove class selected
    $('area').removeClass('selected');
    // select and highlight this area
    $(this).addClass('selected');
    $(this).data('maphilight', {alwaysOn: true}).trigger('alwaysOn.maphilight');
});

这篇关于“永远在线” jquery命令的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆