PDA

View Full Version : Align image with text


p.kennedy
March 7th, 2012, 11:35 AM
I am looking for some javascript that will keep an image aligned with a line of text no matter where that line appears in a textbox... Any ideas?

step
March 7th, 2012, 12:01 PM
Sounds like an image tag would solve your problem

p.kennedy
March 7th, 2012, 12:08 PM
I'm no good at javascript and don't know where to begin

step
March 7th, 2012, 01:15 PM
Read this (http://forums.printable.com/showthread.php?t=616&highlight=image+tag) post

p.kennedy
March 8th, 2012, 08:20 AM
I still can't figure it out. If I upload the job could you take a look?

Dan Korn
March 8th, 2012, 09:08 AM
I still can't figure it out. If I upload the job could you take a look?
There's no guarantee that anyone will look at it, but a picture is always worth a thousand words, so uploading the job will absolutely make it easier for someone to help.

p.kennedy
March 8th, 2012, 09:19 AM
Thanks Dan. The problem starts on body page 4. The versions with 2 "stories" there is a thumbnail image that goes along with each story title. The story two title and thumbnail need to stay aligned no matter the length of the first story. If anyone looks at this and needs to ask any questions I will be available all day to reply to anything

Dan Korn
March 9th, 2012, 09:31 AM
Instead of having the graphics in their own graphic frames, I would use inline graphics, as suggested. And to get everything to flow the way you want, I would put the inline graphics and the text in a table, something like this:
var table = new FPTable;
table.AddColumns(6000, 30000);
table.AddRows(2);
table.Rows[0].Cells[0].Content = '<graphic file="' + Field("Thumbnail") + '" width="' + (table.Columns[0].Width - 2000) + '" />';
table.Rows[0].Cells[1].Content = '<color name="DLCOLOR_5"><z newsize="21">' + TaggedDataField("Story1Title") +
'<p><color name="70K"><z newsize="10">' + TaggedDataField("Stroy1Content");
table.Rows[1].Cells[0].Content = '<graphic file="' + Field("BottomThumbnail") + '" width="' + (table.Columns[0].Width - 2000) + '" />';
table.Rows[1].Cells[1].Content = '<color name="DLCOLOR_5"><z newsize="21">' + TaggedDataField("Story2Title") +
'<p><color name="70K"><z newsize="10">' + TaggedDataField("Story2Content");
return table.MakeTags();

You can change the widths of the columns in the call to table.AddColumns() as needed.