Welcome to the in5 Answer Exchange! This a place to get answers about in5 (InDesign to HTML5) and make requests.
+1 vote
Hey Justin,

is it possible to add a custom class name or some additional parameters to InDesign Objects, that could be exported in in5?
That would be awesome…

BTW: the page-merging script for Baker is a real life saver. Thank you very much for that!!!
in how_to by (160 points)
retagged by
  

2 Answers

0 votes
 
Best answer

Version 2.3.5 now exports the Object Style name (if it's not one of the default styles) and the custom Class Name in the Export Tagging section of the Object Style dialog.


Example:

$('.myObjectStyle').hide();

(the dot [.] denotes a class name with a jQuery selector, just like it does in CSS)

by (197k points)
edited by
0 votes

Hi Sandor,

Glad to hear about the page-merging script!

We'd love to add the ability to add classes to objects. Let us know if you think of a good way to do this from InDesign. We'd love to support it.

Right now, you can add ALT tags and target them with CSS and JS.

There are several ways to add ALT text. From the help docs:

Alt text, an important component in accessibility on the web, is collected from the document in many forms. Button names from the Buttons panel are used, script labels are used (when available), and Alt text from the Object Export Options is used (when available). When textframes are rendered as images and no Alt text is provided using the options listed above, in5 will use text from the textframe as Alt text.

The following CSS would target an ALT tag of redBorder and apply a red border:

[alt=redBorder] { border: 1px solid red; }

The following jQuery would target the same object and hide it:

$("'[alt=redBorder]").hide();

Hope that helps!

by (197k points)
Thanks Justin,

yeah, currently we are going with the ALT tags or with the NAME tags (where this is available – i.e.. MSO Objects). I don't know the extensibility of InDesign good enough to suggest a way for adding classes - but i hope you find a good one...

Thanks
Hello Justin,

...option, to add custom class name to object, will boost upgrading possibilities with jQuery...
- Maybe just using "alt" text to create class name with in5.
- or add extra "RightClick" menu its (like "Mark as thumbnail" option) would be PERFECT...

Now I manually search for object class name to target object. it is time consuming and unreliable, because object class may change during multiple exporting in workflow process.

Best regards, Klemen
Hi, Klemen. You can use the instructions above to work with the alt tag.
Hey Justin,
Is there any update about add custom "class name" within InDesign to be exported by in5. (in meantime in5 mad a huge progress - congrats!)
... thanks for prompt reply, but it is not exported as <...class="pageItem mycustomclass"> but as <...alt="mycustomclass">
I would like to have it ass class="......" to easy handle as CSS or any other method.
If using some ready JS library, it usually handle well classes...
THANKS!!!, You are great
I constantly looking for custom class on "object itself level" (like "script label is") not at "object style level".
Thanks, I can handle this further.