Hi!
You can do this with some javascript, which would give you the precise location to place your image after the text string.
To add javascript to an Axure prototype, you place it where you would normally put the URL string in the command Open Link to External URL
. Or, in Axure 8, Open Link In Current Window
choosing the external URL option.
The below will sound complicated, but don’t sweat it: there’s a sample file attached below.
I’m using a method of encapsulating code that I call a “function.” Axure doesn’t support functions, so I create a hotspot, assign code to the hotspot’s On Moved
event handler, and prefix the hotspot’s name with “function_” so I can identify it as a function. That way when I want to “execute” this function, I just move the hotspot by 0,0. This technique isn’t necessary per-se, it’s just how I organize things.
For instance, if the text of your title is changed by various events in your prototype, you wouldn’t have to copy/paste the Open Link command containing the javascript: you’d just execute the “function” by moving the hotspot.
Below is the javascript code. Note that the name assigned to the widget containing your title text, as well as the name of the image (or dynamic panel or whatever) that you are moving to the end of the string must match the names in the code. The constant “spacing” refers to the space in pixels that you want the image to be placed after the string.
IMPORTANT: if you edit the javascript, avoid deleting the quotation marks, because if “Smart Quotes” are turned on in your operating system, typing a quote will screw everything up.
javascript:
{
/* change values in the 3 lines below if spacing or widget names differ */
const spacing = 10;
const titleWidgetName = "title";
const imageWidgetName = "widgetToMove";
/* do not change code below */
const title = $(`[data-label="${titleWidgetName}"]`);
const axWidget = $axure(`@${imageWidgetName}`);
const span = title.find('span');
axWidget.moveTo(title.position().left + span.width() + spacing, axWidget.top(true),{});
void(0);
}
So where you have the Set Text command that changes the text of your title widget, you’d do the following (pseudo code below):
On Whichever Event
Set Text of title widget to (new text)
Move function hotspot by 0,0
Here is a sample (Axure 8) which also works in Axure 9.
Preview
File: move image to end of title.rp (55.4 KB)