Krpano 动态传参/Javacript调用/关联action

效果解释:点击热点1,触发显示或隐藏热线2。html

例:在热点hotspot的onclick事件下触发。ide

参考资料:code

  • https://krpano.com/docu/xml/#action
  • http://www.krpano360.com/krpano-1-19qianruhtmlyemian/
  • https://www.cnblogs.com/tianyajuanke/p/5843164.html

JavaScript方式:xml

<hotspot name="spot8" style="point_hotspotstyle" ath="-40.231047" atv="30.013785" tooltip="地块标记2" value="0" onclick="delayedcall(0, show_hide_dk('spot5'));"/>
		<hotspot name="spot5" keep="false" visible="false" capture="false" > 
			<point ath="-59.231047" atv="38.013785" />
			<point ath="-40.724703" atv="20.316996" />
			<point ath="-34.629793" atv="30.977534" />
			<point ath="-35.981462" atv="30.756996" />
			<point ath="-38.941133" atv="34.388267" />
			<point ath="-46.442973" atv="35.996213" />
		</hotspot> 

======================================= 割鹿刀 ==============================================

<!-- 触发显示或隐藏 -->
<action name="show_hide_dk" type="Javascript">
	alert(args[1]);
</action>

 

没什么用的方法:htm

hotspot等标签容许编写自定义属性,这里直接设置自定义属性为dk=spot6,点击spot7,显示或隐藏spot6。blog

action方法体中,直接引用get(dk)便可得到对应的属性值。事件

<hotspot name="spot7" style="point_hotspotstyle" ath="8.234451" atv="16.783737" tooltip="地块标记" value="0" dk="spot6" onclick="show_hide_point()"/>
<hotspot name="spot6" keep="true" visible="false" capture="false" > 
		<point ath="2.234451" atv="16.783737" />
		<point ath="18.937711" atv="15.35975" />
		<point ath="25.056067" atv="25.345991" />
		<point ath="3.322098" atv="27.186262" />
</hotspot> 

======================================= 可爱的分割线 ===============================================

  <!-- 触发显示或隐藏 -->
  <action name="show_hide_point">
  	toggle(hotspot[get(dk)].visible);
  </action>
  <action name="show_dk">
  	set(hotspot[get(dk)].visible, true);
  </action>
  <action name="hide_dk">
  	set(hotspot[get(dk)].visible, false);
  </action>
  <action name="show_hide_dkm">
  	toggle(layer[get(dkm)].visible);
  </action>
相关文章
相关标签/搜索