Support

Account

Home Forums Add-ons Repeater Field Create Image Mapper/Hotspot with repeater Reply To: Create Image Mapper/Hotspot with repeater

  • great 🙂 No need to feel embarrassed!

    You could simply target the appropriate input fields and alter their value when user clicks on the image.. when the user first click the link, save the link object to a variable and pass that along to the function for the coordinates. then inside the function where user has clicked the image and gotten the coords you use the link-object to target the corresponding x and y inputs. The code below is just an example of how you could input the values in the right fields 🙂

    
    $('.open-imglatlon').click(function(e){
    
    	e.preventDefault(); //this prevents regular link-click. 
    	var linkobject = $(this);
    	openpopup(linkobject); //the function for opening the popup blabla
    	
    });
    
    function openpopup(linkobject){
    	
    	//blablabla all the code to retrieve the image, put it in the popup and do the x-y coord script 
    	
    	
    	var xcoords = '3213213213'; //just for show, 
    	var ycoords = '3213213213'; //just for show, 
    	
    	// Use the linkbutton, go to the parent tr, find the parent trs siblings which are also tr, then inside those find the input with a parent element with the specific class and change the value of the input to x or y. You can find the specific class from looking in the code on your admin page with a repeater row created. 
    	
    	linkobject.closest('tr').siblings('tr').find('.field_key-field_4f9e754fdedc2 input').val(xcoords);
    	linkobject.closest('tr').siblings('tr').find('.field_key-field_4fwdwaddfffew input').val(ycoords);
    	
    	// I think this could work altho its possible that since the siblings are more than one it wont work.. then you'll have to just get the tr siblings and loop through each like so:
    	linkobject.closest('tr').siblings('tr').each(function(){
    		$(this).find('.field_key-field_4f9e754fdedc2 input').val(xcoords);
    		$(this).find('.field_key-field_4fwdwaddfffew input').val(ycoords);
    	});
    	
    }