【发布时间】:2016-09-17 11:27:42
【问题描述】:
我正在尝试让 2 个插件在 wordpress 网站上协同工作。一个是侧面板插件,可以通过添加class="nks_cc_trigger_element"来触发
到 html <a href="..."> 链接编码。
另一个插件是一个图像映射插件,它只允许我设置链接的 URL,我需要设置 class 属性以通过单击图像的映射形状之一触发侧边栏。开发人员用这段代码向我指出了 API
$.imageMapProEventClickedShape = function(imageMapName, shapeID) {}
我没有使用 jQuery 的经验,这似乎应该是一个简单的解决方案,但我迷路了。相关的 imageMapName 和 shapeID 很容易找到,但我不知道如何简单地使用 jQuery 打开链接或使用 class 属性附加该链接。
感谢任何帮助!
【问题讨论】:
-
您是否尝试使用 jQuery 设置链接(锚)标签的类名?如果有,是否有id属性,或者可以在渲染html时设置一个?
-
您在寻找 $('#shapeid').click() 吗?
-
我什至不确定我在寻找什么。以下是文档中的内容:
Customizing the Image Map using the API Image Map Pro has an API that you can use to trigger various events on the image map. For example, you can have a tooltip open by default. Please read below for the full description of the API. -
Events Events are global functions, which are sent by the plugin when certain things happen. These functions need to be implemented by you, and you can put your own code inside them. Please see the example in the API-demo folder to see how the events are used in practice. The API-demo folder is located in the zip that you downloaded from CodeCanyon. -
所以我想我需要一个可以放在
$.imageMapProEventClickedShape = function(imageMapName, shapeID) {}函数中的代码来打开class=nks_cc_trigger_element类的链接
标签: javascript jquery html wordpress