jQuery cdata link

ekapam

New member
Hi, im working over Wordpress integration, i have a jQuery script that reads href attribute from a link and loaded to my side bar, outside the embed code works perfect, but when i trigger from a inner link coming from my xml configuration doesn't work.

jQuery:
Code:
jQuery(document).ready(function(){
	jQuery('#wr360360bw a').click(function(){
		var page = jQuery(this).attr('href');
		jQuery('#side-bar').load(page);
		return false;
	});
});

Embed code:
Code:
[wr360embed name="360bw" width="100%" height="788px" config="/wp-content/plugins/webrotate-360-product-viewer/360_assets/360bw/360bw.xml"]

XML code:
Code:
<hotspot id="hombro" absolutePosition="false" renderMode="0" className="WebRotate360.ImageRotator.Html5HotspotPresenter" indicatorImage="spot_shape5.png" alpha="0.8">
      <spotinfo>
        <cdata><![CDATA[<a href="/hombro/" target="_parent"><div style="margin-top:-20px;">Hombro</div></a>]]></cdata>
      </spotinfo>
    </hotspot>

Perhaps i missing something, but can you give me an advice?

Thanks.
 

WebSupport

Active member
Hi ekapam, thanks for contacting us here.

This is likely because the actual hotspot <a> element is inserted into browser DOM after images and hotspots are loaded, i.e it happens after you subscribe to the click event, so it never fires..

You may need to bind to document instead:

jQuery(document).on("click", "#wr360360bw a", function() {
alert("test ok");
});

I would also give your <a> some id or class as well as we have a lot of extra <a> elements there.
 
Top